Skip to content

Commit 17f4c2a

Browse files
committed
add codegen test
1 parent 6c67e55 commit 17f4c2a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/codegen/vec-in-place.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// compile-flags: -O
2+
// min-llvm-version: 11.0
3+
#![crate_type = "lib"]
4+
5+
// Ensure that trivial casts of vec elements are O(1)
6+
7+
// CHECK-LABEL: @vec_iterator_cast
8+
#[no_mangle]
9+
pub fn vec_iterator_cast(vec: Vec<isize>) -> Vec<usize> {
10+
// CHECK-NOT: loop
11+
// CHECK-NOT: call
12+
vec.into_iter().map(|e| e as usize).collect()
13+
}

0 commit comments

Comments
 (0)