summary refs log tree commit diff
path: root/src/test/codegen/vec-in-place.rs
blob: a656c9e6f656a8f01db6717e3bfff5ec27d5d3bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// ignore-debug: the debug assertions get in the way
// compile-flags: -O
#![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()
}