Skip to content

Commit 95740fb

Browse files
committed
add codegen test for #36010
1 parent 5f527eb commit 95740fb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![crate_type = "lib"]
2+
3+
//@ compile-flags: -O
4+
5+
use std::mem;
6+
7+
fn foo<T>(a: &mut T, b: T) -> bool {
8+
let b = Some(mem::replace(a, b));
9+
let ret = b.is_some();
10+
mem::forget(b);
11+
return ret
12+
}
13+
14+
// CHECK-LABEL: @foo_u32
15+
// CHECK: store i32
16+
// CHECK-NEXT: ret i1
17+
#[no_mangle]
18+
pub fn foo_u32(a: &mut u32, b: u32) -> bool {
19+
foo(a, b)
20+
}
21+
22+
// CHECK-LABEL: @foo_box
23+
// CHECK: store ptr
24+
// CHECK-NEXT: ret i1
25+
#[no_mangle]
26+
pub fn foo_box(a: &mut Box<u32>, b: Box<u32>) -> bool {
27+
foo(a, b)
28+
}
29+

0 commit comments

Comments
 (0)