add codegen test for issue 120493

This commit is contained in:
Joshua Wong 2024-05-19 19:10:45 -05:00
parent 12075f04e6
commit a4efe6fe27

View File

@ -90,3 +90,25 @@ pub fn vec_iterator_cast_unwrap(vec: Vec<Wrapper<u8>>) -> Vec<u8> {
// correct.
vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect()
}
// CHECK-LABEL: @vec_iterator_cast_unwrap_drop
#[no_mangle]
pub fn vec_iterator_cast_unwrap_drop(vec: Vec<Wrapper<String>>) -> Vec<String> {
// CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
// CHECK-NOT: call
// CHECK-NOT: %{{.*}} = mul
// CHECK-NOT: %{{.*}} = udiv
vec.into_iter().map(|Wrapper(e)| e).collect()
}
// CHECK-LABEL: @vec_iterator_cast_wrap_drop
#[no_mangle]
pub fn vec_iterator_cast_wrap_drop(vec: Vec<String>) -> Vec<Wrapper<String>> {
// CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
// CHECK-NOT: call
// CHECK-NOT: %{{.*}} = mul
// CHECK-NOT: %{{.*}} = udiv
vec.into_iter().map(Wrapper).collect()
}