diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/codegen/function-arguments.rs | 10 | ||||
| -rw-r--r-- | tests/ui/abi/compatibility.rs | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs index b75c188f51a..e6e2f645714 100644 --- a/tests/codegen/function-arguments.rs +++ b/tests/codegen/function-arguments.rs @@ -2,6 +2,7 @@ #![crate_type = "lib"] #![feature(dyn_star)] #![feature(generic_nonzero)] +#![feature(allocator_api)] use std::mem::MaybeUninit; use std::num::NonZero; @@ -182,6 +183,15 @@ pub fn _box(x: Box<i32>) -> Box<i32> { x } +// With a custom allocator, it should *not* have `noalias`. (See +// <https://github.com/rust-lang/miri/issues/3341> for why.) The second argument is the allocator, +// which is a reference here that still carries `noalias` as usual. +// CHECK: @_box_custom(ptr noundef nonnull align 4 %x.0, ptr noalias noundef nonnull readonly align 1 %x.1) +#[no_mangle] +pub fn _box_custom(x: Box<i32, &std::alloc::Global>) { + drop(x) +} + // CHECK: noundef nonnull align 4 ptr @notunpin_box(ptr noundef nonnull align 4 %x) #[no_mangle] pub fn notunpin_box(x: Box<NotUnpin>) -> Box<NotUnpin> { diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index 2449e515f5f..a4f60ea2684 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -160,6 +160,7 @@ mod prelude { pub _marker: PhantomData<T>, } + #[lang = "global_alloc_ty"] pub struct Global; #[lang = "owned_box"] |
