]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/vec-in-place.rs
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk
[rust.git] / src / test / codegen / vec-in-place.rs
1 // ignore-debug: the debug assertions get in the way
2 // compile-flags: -O
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 }