Skip to content

Commit 83cceea

Browse files
authored
Rollup merge of #125305 - jwong101:120493-codegen-test, r=the8472
add some codegen tests for issue 120493 I forgot to add these in #123878.
2 parents 9987e90 + a4efe6f commit 83cceea

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/codegen/vec-in-place.rs

+22
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,25 @@ pub fn vec_iterator_cast_deaggregate_fold(vec: Vec<Baz>) -> Vec<[u64; 4]> {
9090
// correct.
9191
vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect()
9292
}
93+
94+
// CHECK-LABEL: @vec_iterator_cast_unwrap_drop
95+
#[no_mangle]
96+
pub fn vec_iterator_cast_unwrap_drop(vec: Vec<Wrapper<String>>) -> Vec<String> {
97+
// CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
98+
// CHECK-NOT: call
99+
// CHECK-NOT: %{{.*}} = mul
100+
// CHECK-NOT: %{{.*}} = udiv
101+
102+
vec.into_iter().map(|Wrapper(e)| e).collect()
103+
}
104+
105+
// CHECK-LABEL: @vec_iterator_cast_wrap_drop
106+
#[no_mangle]
107+
pub fn vec_iterator_cast_wrap_drop(vec: Vec<String>) -> Vec<Wrapper<String>> {
108+
// CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
109+
// CHECK-NOT: call
110+
// CHECK-NOT: %{{.*}} = mul
111+
// CHECK-NOT: %{{.*}} = udiv
112+
113+
vec.into_iter().map(Wrapper).collect()
114+
}

0 commit comments

Comments
 (0)