Skip to content

Commit 0f7d7a5

Browse files
committed
add a codegen-llvm test for ManuallyDrop
1 parent 95eee60 commit 0f7d7a5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
2+
#![crate_type = "lib"]
3+
4+
use std::mem::ManuallyDrop;
5+
6+
// CHECK: define noundef nonnull align 1 ptr @f(ptr noalias noundef nonnull readnone returned align 1 {{(captures\(ret: address, provenance\))?}} %x) unnamed_addr
7+
#[no_mangle]
8+
pub fn f(x: ManuallyDrop<Box<u8>>) -> ManuallyDrop<Box<u8>> {
9+
x
10+
}
11+
12+
// CHECK: define noundef nonnull align 1 dereferenceable(1) ptr @g(ptr noalias noundef readonly returned align 1 {{(captures\(ret: address, read_provenance\))?}} dereferenceable(1) %x) unnamed_addr
13+
#[no_mangle]
14+
pub fn g(x: ManuallyDrop<&u8>) -> ManuallyDrop<&u8> {
15+
x
16+
}
17+
18+
// CHECK: define noundef nonnull align 1 dereferenceable(1) ptr @h(ptr noalias noundef readnone returned align 1 {{(captures\(ret: address, provenance\))?}} dereferenceable(1) %x) unnamed_addr
19+
#[no_mangle]
20+
pub fn h(x: ManuallyDrop<&mut u8>) -> ManuallyDrop<&mut u8> {
21+
x
22+
}

0 commit comments

Comments
 (0)