Skip to content

Commit 901e77d

Browse files
committed
add a codegen-llvm test for ManuallyDrop
1 parent 7418157 commit 901e77d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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>> { x }
10+
11+
// 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
12+
#[no_mangle]
13+
pub fn g(x: ManuallyDrop<&u8>) -> ManuallyDrop<&u8> { x }
14+
15+
// 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
16+
#[no_mangle]
17+
pub fn h(x: ManuallyDrop<&mut u8>) -> ManuallyDrop<&mut u8> { x }

0 commit comments

Comments
 (0)