rust/src/test/codegen/vec-in-place.rs
2021-03-21 23:05:36 +01:00

15 lines
383 B
Rust

// ignore-debug: the debug assertions get in the way
// compile-flags: -O
// min-llvm-version: 11.0
#![crate_type = "lib"]
// Ensure that trivial casts of vec elements are O(1)
// CHECK-LABEL: @vec_iterator_cast
#[no_mangle]
pub fn vec_iterator_cast(vec: Vec<isize>) -> Vec<usize> {
// CHECK-NOT: loop
// CHECK-NOT: call
vec.into_iter().map(|e| e as usize).collect()
}