]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/vec-in-place.rs
Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into sync_cg_clif-2021-05-27
[rust.git] / src / test / codegen / vec-in-place.rs
1 // ignore-debug: the debug assertions get in the way
2 // compile-flags: -O
3 // min-llvm-version: 11.0
4 #![crate_type = "lib"]
5
6 // Ensure that trivial casts of vec elements are O(1)
7
8 // CHECK-LABEL: @vec_iterator_cast
9 #[no_mangle]
10 pub fn vec_iterator_cast(vec: Vec<isize>) -> Vec<usize> {
11     // CHECK-NOT: loop
12     // CHECK-NOT: call
13     vec.into_iter().map(|e| e as usize).collect()
14 }