diff options
Diffstat (limited to 'src/test/codegen/function-arguments.rs')
| -rw-r--r-- | src/test/codegen/function-arguments.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index f11e769ca6c..7706c97380b 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -87,6 +87,53 @@ pub fn struct_return() -> S { } } +// Hack to get the correct size for the length part in slices +// CHECK: @helper([[USIZE:i[0-9]+]]) +#[no_mangle] +fn helper(_: usize) { +} + +// CHECK: @slice(i8* noalias nonnull readonly, [[USIZE]]) +// FIXME #25759 This should also have `nocapture` +#[no_mangle] +fn slice(_: &[u8]) { +} + +// CHECK: @mutable_slice(i8* noalias nonnull, [[USIZE]]) +// FIXME #25759 This should also have `nocapture` +#[no_mangle] +fn mutable_slice(_: &mut [u8]) { +} + +// CHECK: @unsafe_slice(%UnsafeInner* nonnull, [[USIZE]]) +// unsafe interior means this isn't actually readonly and there may be aliases ... +#[no_mangle] +pub fn unsafe_slice(_: &[UnsafeInner]) { +} + +// CHECK: @str(i8* noalias nonnull readonly, [[USIZE]]) +// FIXME #25759 This should also have `nocapture` +#[no_mangle] +fn str(_: &[u8]) { +} + +// CHECK: @trait_borrow(i8* nonnull, void (i8*)** nonnull) +// FIXME #25759 This should also have `nocapture` +#[no_mangle] +fn trait_borrow(_: &Drop) { +} + +// CHECK: @trait_box(i8* noalias nonnull, void (i8*)** nonnull) +#[no_mangle] +fn trait_box(_: Box<Drop>) { +} + +// CHECK: { i16*, [[USIZE]] } @return_slice(i16* noalias nonnull readonly, [[USIZE]]) +#[no_mangle] +fn return_slice(x: &[u16]) -> &[u16] { + x +} + // CHECK: noalias i8* @allocator() #[no_mangle] #[allocator] |
