1
Fork 0

Rollup merge of #125305 - jwong101:120493-codegen-test, r=the8472

add some codegen tests for issue 120493

I forgot to add these in https://github.com/rust-lang/rust/pull/123878.
This commit is contained in:
Matthias Krüger 2024-05-20 18:13:48 +02:00 committed by GitHub
commit 83cceeaf37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -90,3 +90,25 @@ pub fn vec_iterator_cast_deaggregate_fold(vec: Vec<Baz>) -> Vec<[u64; 4]> {
// 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()
}