Skip to content

Commit a6b59fc

Browse files
committed
add a codegen-llvm test for ManuallyDrop
1 parent 2c3d88b commit a6b59fc

File tree

1 file changed

+23
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)