From 5d260fd3da7b0165d6365adab12746bfc389d913 Mon Sep 17 00:00:00 2001 From: Max Dexheimer Date: Tue, 15 Sep 2026 10:05:04 +0200 Subject: [PATCH] Replace `Unique` in `Box` with a `(NonNull, PhantomData)` wrapper --- .../src/elaborate_box_derefs.rs | 2 +- library/alloc/src/boxed.rs | 88 +++++++++++++++++-- .../newtype_pair_retagging.stack.stderr | 2 +- .../newtype_retagging.stack.stderr | 2 +- ...al_drop_allocator.main.ElaborateDrops.diff | 4 +- ...artial_move.maybe_move.ElaborateDrops.diff | 2 +- tests/mir-opt/box_partial_move.rs | 2 +- .../transmute.unreachable_box.GVN.32bit.diff | 6 +- .../transmute.unreachable_box.GVN.64bit.diff | 6 +- ...d_in_vec.build-{closure#0}.built.after.mir | 2 +- ...n.DataflowConstProp.32bit.panic-abort.diff | 14 +-- ....DataflowConstProp.32bit.panic-unwind.diff | 14 +-- ...n.DataflowConstProp.64bit.panic-abort.diff | 14 +-- ....DataflowConstProp.64bit.panic-unwind.diff | 14 +-- ...oxed_slice.main.GVN.32bit.panic-abort.diff | 18 ++-- ...xed_slice.main.GVN.32bit.panic-unwind.diff | 18 ++-- ...oxed_slice.main.GVN.64bit.panic-abort.diff | 18 ++-- ...xed_slice.main.GVN.64bit.panic-unwind.diff | 18 ++-- ...reachable_box.DataflowConstProp.32bit.diff | 4 +- ...reachable_box.DataflowConstProp.64bit.diff | 4 +- ...ng_operand.test.GVN.32bit.panic-abort.diff | 2 +- ...g_operand.test.GVN.32bit.panic-unwind.diff | 2 +- ...ng_operand.test.GVN.64bit.panic-abort.diff | 2 +- ...g_operand.test.GVN.64bit.panic-unwind.diff | 2 +- ..._debuginfo.pointee.ElaborateBoxDerefs.diff | 2 +- ...ric_rust_call.call.Inline.panic-abort.diff | 4 +- ...ic_rust_call.call.Inline.panic-unwind.diff | 4 +- ...inline_box_fn.call.Inline.panic-abort.diff | 4 +- ...nline_box_fn.call.Inline.panic-unwind.diff | 4 +- ...67_inline_as_ref_as_mut.b.Inline.after.mir | 4 +- ...67_inline_as_ref_as_mut.d.Inline.after.mir | 4 +- .../unsized_argument.caller.Inline.diff | 2 +- ...inhabited.LowerIntrinsics.panic-abort.diff | 2 +- ...nhabited.LowerIntrinsics.panic-unwind.diff | 2 +- ...es.runtime-optimized.after.panic-abort.mir | 10 +-- ...s.runtime-optimized.after.panic-unwind.mir | 10 +-- ...ic.runtime-optimized.after.panic-abort.mir | 10 +-- ...c.runtime-optimized.after.panic-unwind.mir | 10 +-- ...time-optimized.after.32bit.panic-abort.mir | 10 +-- ...ime-optimized.after.32bit.panic-unwind.mir | 10 +-- ...time-optimized.after.64bit.panic-abort.mir | 10 +-- ...ime-optimized.after.64bit.panic-unwind.mir | 10 +-- .../ui/delegation/self-coercion-errors.stderr | 12 +-- .../self-mapping-arguments-errors.stderr | 2 +- ...lobal-variable-promotion-error-7364.stderr | 2 +- tests/ui/traits/cycle-cache-err-60010.stderr | 8 +- .../negated-auto-traits-error.stderr | 8 +- .../ui/traits/send-trait-objects-basic.stderr | 6 +- tests/ui/typeck/issue-82772.rs | 2 + tests/ui/typeck/issue-82772.stderr | 12 ++- 50 files changed, 251 insertions(+), 173 deletions(-) diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs index 5b561a9d2dd0a..7f107dfcc0cab 100644 --- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs +++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs @@ -57,7 +57,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'a, 'tcx> { let ptr_local = self.patch.new_temp(ptr_ty, source_info.span); - // Project to the first field (a `Unique`), then transmute that. We could project one + // Project to the first field (a `BoxRaw`), then transmute that. We could project one // further but in the end we'd hit a pattern type so we'd always have to transmute. let field_place = Place::from(place.local).project_to_field(FieldIdx::ZERO, &*self.local_decls, tcx); diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index 6477858f14b83..e91ee6ea0c315 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -190,7 +190,7 @@ use core::error::{self, Error}; use core::fmt; use core::future::Future; use core::hash::{Hash, Hasher}; -use core::marker::{Tuple, Unsize}; +use core::marker::{PhantomData, Tuple, Unsize}; #[cfg(not(no_global_oom_handling))] use core::mem::MaybeUninit; use core::mem::{self, SizedTypeProperties}; @@ -201,7 +201,7 @@ use core::ops::{ #[cfg(not(no_global_oom_handling))] use core::ops::{Residual, Try}; use core::pin::{Pin, PinSafePointer}; -use core::ptr::{self, NonNull, Unique}; +use core::ptr::{self, NonNull}; use core::task::{Context, Poll}; #[cfg(not(no_global_oom_handling))] @@ -223,6 +223,71 @@ pub use iter::BoxedArrayIntoIter; #[unstable(feature = "thin_box", issue = "92791")] pub use thin::ThinBox; +/// An internal wrapper for the pointer + `PhantomData` inside a `Box`. +/// This type has no semantic meaning. It only exists because the layout of +/// `Box` is hard-coded into the compiler, and because moving the +/// auto trait impls to `Box` would cause regressions (#162850). +#[repr(transparent)] +struct BoxRaw { + pointer: NonNull, + _marker: PhantomData, +} + +unsafe impl Send for BoxRaw {} +unsafe impl Sync for BoxRaw {} +impl core::panic::UnwindSafe for BoxRaw {} +impl CoerceUnsized> for BoxRaw where T: Unsize {} +impl DispatchFromDyn> for BoxRaw where T: Unsize {} + +impl BoxRaw { + /// # Safety + /// `ptr` must be non-null + #[inline] + const unsafe fn new_unchecked(ptr: *mut T) -> Self { + // SAFETY: Upheld by the caller + unsafe { BoxRaw { pointer: NonNull::new_unchecked(ptr), _marker: PhantomData } } + } + + #[inline] + const fn cast(self) -> BoxRaw { + BoxRaw { pointer: self.pointer.cast(), _marker: PhantomData } + } + + #[inline] + const fn as_non_null_ptr(self) -> NonNull { + self.pointer + } + + #[inline] + const fn as_ptr(self) -> *mut T { + self.pointer.as_ptr() + } + + #[inline] + #[cfg(not(no_global_oom_handling))] + const fn dangling() -> Self + where + T: Sized, + { + BoxRaw { pointer: NonNull::dangling(), _marker: PhantomData } + } +} + +impl Clone for BoxRaw { + fn clone(&self) -> Self { + *self + } +} +impl Copy for BoxRaw {} + +#[expect(ineffective_unstable_trait_impl, reason = "See #164109")] +#[unstable(feature = "box_internals", issue = "none")] +impl From> for NonNull { + fn from(value: BoxRaw) -> Self { + value.as_non_null_ptr() + } +} + /// A pointer type that uniquely owns a heap allocation of type `T`. /// /// See the [module-level documentation](../../std/boxed/index.html) for more. @@ -236,7 +301,7 @@ pub use thin::ThinBox; pub struct Box< T: ?Sized, #[stable(feature = "allocator_api", since = "1.100.0")] A: Allocator = Global, ->(Unique, A); +>(BoxRaw, A); /// Monomorphic function for allocating an uninit `Box`. #[inline] @@ -1566,7 +1631,7 @@ impl Box { #[inline] pub unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self { // SAFETY: Upheld by caller. - Box(unsafe { Unique::new_unchecked(raw) }, alloc) + Box(unsafe { BoxRaw::new_unchecked(raw) }, alloc) } /// Constructs a box from a `NonNull` pointer in the given allocator. @@ -2024,7 +2089,9 @@ impl Default for Box<[T]> { /// Creates an empty `[T]` inside a `Box`. #[inline] fn default() -> Self { - let ptr: Unique<[T]> = Unique::<[T; 0]>::dangling(); + let ptr: BoxRaw<[T]> = BoxRaw::<[T; 0]>::dangling(); + // SAFETY: `[T; 0]` is a ZST, for which `dangling` is valid to turn into a `Box`, + // even after unsize coercion. Box(ptr, Global) } } @@ -2034,10 +2101,13 @@ impl Default for Box<[T]> { impl Default for Box { #[inline] fn default() -> Self { - // SAFETY: This is the same as `Unique::cast` but with an unsized `U = str`. - let ptr: Unique = unsafe { - let bytes: Unique<[u8]> = Unique::<[u8; 0]>::dangling(); - Unique::new_unchecked(bytes.as_ptr() as *mut str) + // SAFETY: + // - `[u8; 0]` is a ZST, for which `dangling` is valid to turn into a `Box` + // - Casting `[u8]` to `str` is correct + // - The empty byte slice is valid UTF-8 + let ptr: BoxRaw = unsafe { + let bytes: BoxRaw<[u8]> = BoxRaw::<[u8; 0]>::dangling(); + BoxRaw::new_unchecked(bytes.as_ptr() as *mut str) }; Box(ptr, Global) } diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.stack.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.stack.stderr index 2f10e7df418f4..02337c1c9de99 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.stack.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.stack.stderr @@ -1,7 +1,7 @@ error: Undefined Behavior: not granting access to tag because that would remove [Unique for ] which is strongly protected --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | Box(unsafe { Unique::new_unchecked(raw) }, alloc) +LL | Box(unsafe { BoxRaw::new_unchecked(raw) }, alloc) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.stack.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.stack.stderr index a173cf25e9e78..90ef414701fbe 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.stack.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.stack.stderr @@ -1,7 +1,7 @@ error: Undefined Behavior: not granting access to tag because that would remove [Unique for ] which is strongly protected --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | Box(unsafe { Unique::new_unchecked(raw) }, alloc) +LL | Box(unsafe { BoxRaw::new_unchecked(raw) }, alloc) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental diff --git a/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff index 6f6c239d7c831..d855a5ab250a3 100644 --- a/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff +++ b/tests/mir-opt/box_conditional_drop_allocator.main.ElaborateDrops.diff @@ -149,7 +149,7 @@ + } + + bb22: { -+ _14 = copy ((_1.0: std::ptr::Unique).0: std::ptr::NonNull) as *const HasDrop (Transmute); ++ _14 = copy ((_1.0: std::boxed::BoxRaw).0: std::ptr::NonNull) as *const HasDrop (Transmute); + goto -> bb21; + } + @@ -175,7 +175,7 @@ + } + + bb28 (cleanup): { -+ _17 = copy ((_1.0: std::ptr::Unique).0: std::ptr::NonNull) as *const HasDrop (Transmute); ++ _17 = copy ((_1.0: std::boxed::BoxRaw).0: std::ptr::NonNull) as *const HasDrop (Transmute); + goto -> bb27; + } + diff --git a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff index a22ea0b2c5789..3f9dcf1d69178 100644 --- a/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff +++ b/tests/mir-opt/box_partial_move.maybe_move.ElaborateDrops.diff @@ -83,7 +83,7 @@ + } + + bb13: { -+ _10 = copy ((_2.0: std::ptr::Unique).0: std::ptr::NonNull) as *const std::string::String (Transmute); ++ _10 = copy ((_2.0: std::boxed::BoxRaw).0: std::ptr::NonNull) as *const std::string::String (Transmute); + goto -> bb10; } } diff --git a/tests/mir-opt/box_partial_move.rs b/tests/mir-opt/box_partial_move.rs index 5cbd242986f52..f356ff5411547 100644 --- a/tests/mir-opt/box_partial_move.rs +++ b/tests/mir-opt/box_partial_move.rs @@ -7,7 +7,7 @@ fn maybe_move(cond: bool, thing: Box) -> Option { // CHECK-LABEL: fn maybe_move( // CHECK: let mut [[PTR:_[0-9]+]]: *const std::string::String; - // CHECK: [[PTR]] = copy ((_2.0: std::ptr::Unique).0: std::ptr::NonNull) as *const std::string::String (Transmute); + // CHECK: [[PTR]] = copy ((_2.0: std::boxed::BoxRaw).0: std::ptr::NonNull) as *const std::string::String (Transmute); // CHECK: drop((*[[PTR]])) if cond { Some(*thing) } else { None } } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff index f87e33bd69789..f1b50e4ccac1f 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff @@ -12,9 +12,9 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box (Transmute); -- _2 = copy (_1.0: std::ptr::Unique) as *const Never (BoxDerefTransmute); -+ _1 = const Box::(std::ptr::Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); -+ _2 = const std::ptr::Unique:: {{ pointer: std::ptr::NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: std::marker::PhantomData:: }} as *const Never (BoxDerefTransmute); +- _2 = copy (_1.0: std::boxed::BoxRaw) as *const Never (BoxDerefTransmute); ++ _1 = const Box::(boxed::BoxRaw:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); ++ _2 = const std::boxed::BoxRaw:: {{ pointer: std::ptr::NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: std::marker::PhantomData:: }} as *const Never (BoxDerefTransmute); unreachable; } } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff index f87e33bd69789..f1b50e4ccac1f 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff @@ -12,9 +12,9 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box (Transmute); -- _2 = copy (_1.0: std::ptr::Unique) as *const Never (BoxDerefTransmute); -+ _1 = const Box::(std::ptr::Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); -+ _2 = const std::ptr::Unique:: {{ pointer: std::ptr::NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: std::marker::PhantomData:: }} as *const Never (BoxDerefTransmute); +- _2 = copy (_1.0: std::boxed::BoxRaw) as *const Never (BoxDerefTransmute); ++ _1 = const Box::(boxed::BoxRaw:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); ++ _2 = const std::boxed::BoxRaw:: {{ pointer: std::ptr::NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: std::marker::PhantomData:: }} as *const Never (BoxDerefTransmute); unreachable; } } diff --git a/tests/mir-opt/coroutine/unwind_in_vec.build-{closure#0}.built.after.mir b/tests/mir-opt/coroutine/unwind_in_vec.build-{closure#0}.built.after.mir index 6b9927949ffe2..db46970999856 100644 --- a/tests/mir-opt/coroutine/unwind_in_vec.build-{closure#0}.built.after.mir +++ b/tests/mir-opt/coroutine/unwind_in_vec.build-{closure#0}.built.after.mir @@ -1,7 +1,7 @@ // MIR for `build::{closure#0}` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(Box<^c_0>::new_uninit at for Box<^c_1, ^c_2>>), max_universe: U0, var_kinds: [Ty { ui: U0, sub_root: 0 }, Ty { ui: U0, sub_root: 1 }, Ty { ui: U0, sub_root: 2 }] }, span: $SRC_DIR/alloc/src/macros.rs:LL:COL, inferred_ty: fn() -> std::boxed::Box> {std::boxed::Box::<[std::string::String; 5]>::new_uninit} +| 0: user_ty: Canonical { value: TypeOf(Box<^c_0>::new_uninit at for Box<^c_1, ^c_2>>), max_universe: U0, var_kinds: [Ty { ui: U0, sub_root: 0 }, Ty { ui: U0, sub_root: 1 }, Ty { ui: U0, sub_root: 2 }] }, span: $SRC_DIR/alloc/src/macros.rs:LL:COL, inferred_ty: fn() -> std::boxed::Box> {std::boxed::Box::<[std::string::String; 5]>::new_uninit} | fn build::{closure#0}(_1: {async fn body of build()}, _2: std::future::ResumeTy) -> Vec yields () diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff index 436f0350700e3..ca4c24e54c744 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,13 +35,13 @@ StorageLive(_4); StorageLive(_5); _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; - _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; + _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; + _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); + _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; + _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff index 616f92cb81198..bc90f9ee030ad 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,13 +35,13 @@ StorageLive(_4); StorageLive(_5); _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; - _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; + _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; + _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); + _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; + _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff index 70153ea3cb940..920a40ba752de 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,13 +35,13 @@ StorageLive(_4); StorageLive(_5); _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; - _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; + _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; + _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); + _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; + _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff index 158861f0d07ef..0d4b345995b7a 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,13 +35,13 @@ StorageLive(_4); StorageLive(_5); _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; - _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; + _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); - _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; + _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); + _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; + _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff index 042af7d87f1f7..87fc6a5d51356 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,18 +35,18 @@ StorageLive(_4); StorageLive(_5); - _5 = const <[bool; 0] as std::mem::SizedTypeProperties>::ALIGNMENT as std::ptr::NonNull<[bool; 0]> (Transmute); -- _4 = std::ptr::Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = boxed::BoxRaw::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; -+ _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; ++ _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); -- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit)); -+ _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; +- _3 = move _4 as std::boxed::BoxRaw<[bool]> (PointerCoercion(Unsize, Implicit)); ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(copy _3, const std::alloc::Global); -+ _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); ++ _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; -+ _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; ++ _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff index 73025eb4ce5c4..ced4e9e3db145 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,18 +35,18 @@ StorageLive(_4); StorageLive(_5); - _5 = const <[bool; 0] as std::mem::SizedTypeProperties>::ALIGNMENT as std::ptr::NonNull<[bool; 0]> (Transmute); -- _4 = std::ptr::Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = boxed::BoxRaw::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; -+ _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; ++ _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); -- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit)); -+ _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; +- _3 = move _4 as std::boxed::BoxRaw<[bool]> (PointerCoercion(Unsize, Implicit)); ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(copy _3, const std::alloc::Global); -+ _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); ++ _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; -+ _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; ++ _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff index e2bc701f3dc9f..c12d46519198e 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,18 +35,18 @@ StorageLive(_4); StorageLive(_5); - _5 = const <[bool; 0] as std::mem::SizedTypeProperties>::ALIGNMENT as std::ptr::NonNull<[bool; 0]> (Transmute); -- _4 = std::ptr::Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = boxed::BoxRaw::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; -+ _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; ++ _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); -- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit)); -+ _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; +- _3 = move _4 as std::boxed::BoxRaw<[bool]> (PointerCoercion(Unsize, Implicit)); ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(copy _3, const std::alloc::Global); -+ _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); ++ _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; -+ _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; ++ _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff index 35d824ee17fc2..5559865cdaa69 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff @@ -9,11 +9,11 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; + let _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::boxed::BoxRaw<[bool; 0]>; scope 3 { } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { + scope 4 (inlined boxed::BoxRaw::<[bool; 0]>::dangling) { let mut _5: std::ptr::NonNull<[bool; 0]>; scope 5 (inlined NonNull::<[bool; 0]>::dangling) { scope 6 { @@ -35,18 +35,18 @@ StorageLive(_4); StorageLive(_5); - _5 = const <[bool; 0] as std::mem::SizedTypeProperties>::ALIGNMENT as std::ptr::NonNull<[bool; 0]> (Transmute); -- _4 = std::ptr::Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; +- _4 = boxed::BoxRaw::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> }; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}; -+ _4 = const std::ptr::Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; ++ _4 = const boxed::BoxRaw::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} is !null }}, _marker: PhantomData::<[bool; 0]> }}; StorageDead(_5); -- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit)); -+ _3 = const std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; +- _3 = move _4 as std::boxed::BoxRaw<[bool]> (PointerCoercion(Unsize, Implicit)); ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); - _2 = Box::<[bool]>(copy _3, const std::alloc::Global); -+ _2 = const Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); ++ _2 = const Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_3); - _1 = A { foo: move _2 }; -+ _1 = const A {{ foo: Box::<[bool]>(std::ptr::Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; ++ _1 = const A {{ foo: Box::<[bool]>(boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }}; StorageDead(_2); _0 = const (); drop(_1) -> [return: bb1, unwind: bb2]; diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff index aaa0655d3c60e..8a3c3ad12a8bd 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff @@ -12,8 +12,8 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box (Transmute); -+ _1 = const Box::(std::ptr::Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); - _2 = copy (_1.0: std::ptr::Unique) as *const Never (BoxDerefTransmute); ++ _1 = const Box::(boxed::BoxRaw:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); + _2 = copy (_1.0: std::boxed::BoxRaw) as *const Never (BoxDerefTransmute); unreachable; } } diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff index aaa0655d3c60e..8a3c3ad12a8bd 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff @@ -12,8 +12,8 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box (Transmute); -+ _1 = const Box::(std::ptr::Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); - _2 = copy (_1.0: std::ptr::Unique) as *const Never (BoxDerefTransmute); ++ _1 = const Box::(boxed::BoxRaw:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} is !null }}, _marker: PhantomData:: }}, std::alloc::Global); + _2 = copy (_1.0: std::boxed::BoxRaw) as *const Never (BoxDerefTransmute); unreachable; } } diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff index 451d639ca2aa4..ebf10f94313d5 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff @@ -73,7 +73,7 @@ StorageDead(_2); StorageLive(_5); _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::ptr::Unique<()>) as *const () (BoxDerefTransmute); + _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); _5 = &raw const (*_11); StorageLive(_6); StorageLive(_7); diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff index 75b00c8885cd0..503d931849567 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff @@ -53,7 +53,7 @@ StorageDead(_2); StorageLive(_5); _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::ptr::Unique<()>) as *const () (BoxDerefTransmute); + _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); _5 = &raw const (*_11); StorageLive(_6); StorageLive(_7); diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff index 3473ceb21a0ab..888454e6eb5a9 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -73,7 +73,7 @@ StorageDead(_2); StorageLive(_5); _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::ptr::Unique<()>) as *const () (BoxDerefTransmute); + _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); _5 = &raw const (*_11); StorageLive(_6); StorageLive(_7); diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff index 75b00c8885cd0..503d931849567 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff @@ -53,7 +53,7 @@ StorageDead(_2); StorageLive(_5); _10 = no_retag copy (*_1); - _11 = copy (_10.0: std::ptr::Unique<()>) as *const () (BoxDerefTransmute); + _11 = copy (_10.0: std::boxed::BoxRaw<()>) as *const () (BoxDerefTransmute); _5 = &raw const (*_11); StorageLive(_6); StorageLive(_7); diff --git a/tests/mir-opt/elaborate_box_deref_in_debuginfo.pointee.ElaborateBoxDerefs.diff b/tests/mir-opt/elaborate_box_deref_in_debuginfo.pointee.ElaborateBoxDerefs.diff index 80569904893c1..f0a41e1514fb9 100644 --- a/tests/mir-opt/elaborate_box_deref_in_debuginfo.pointee.ElaborateBoxDerefs.diff +++ b/tests/mir-opt/elaborate_box_deref_in_debuginfo.pointee.ElaborateBoxDerefs.diff @@ -3,7 +3,7 @@ fn pointee(_1: Box) -> () { - debug foo => (*_1); -+ debug foo => (*((((_1.0: std::ptr::Unique).0: std::ptr::NonNull).0: pattern_type!(*const i32 is !null)).0: *const i32)); ++ debug foo => (*((((_1.0: std::boxed::BoxRaw).0: std::ptr::NonNull).0: pattern_type!(*const i32 is !null)).0: *const i32)); let mut _0: (); bb0: { diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff index 92060c211330e..c8393317903dd 100644 --- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-abort.diff @@ -10,7 +10,7 @@ + scope 1 (inlined > as FnMut>::call_mut) { + let mut _5: &mut dyn std::ops::FnMut; + let mut _6: *const dyn std::ops::FnMut; -+ let mut _7: std::ptr::Unique>; ++ let mut _7: std::boxed::BoxRaw>; + } bb0: { @@ -22,7 +22,7 @@ + StorageLive(_6); + StorageLive(_7); + StorageLive(_5); -+ _7 = no_retag copy ((*_3).0: std::ptr::Unique>); ++ _7 = no_retag copy ((*_3).0: std::boxed::BoxRaw>); + _6 = copy _7 as *const dyn std::ops::FnMut (BoxDerefTransmute); + _5 = &mut (*_6); + _0 = as FnMut>::call_mut(move _5, move _4) -> [return: bb2, unwind unreachable]; diff --git a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff index 085fa453ade13..5e2c58430f9c1 100644 --- a/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dont_ice_on_generic_rust_call.call.Inline.panic-unwind.diff @@ -10,7 +10,7 @@ + scope 1 (inlined > as FnMut>::call_mut) { + let mut _5: &mut dyn std::ops::FnMut; + let mut _6: *const dyn std::ops::FnMut; -+ let mut _7: std::ptr::Unique>; ++ let mut _7: std::boxed::BoxRaw>; + } bb0: { @@ -22,7 +22,7 @@ + StorageLive(_6); + StorageLive(_7); + StorageLive(_5); -+ _7 = no_retag copy ((*_3).0: std::ptr::Unique>); ++ _7 = no_retag copy ((*_3).0: std::boxed::BoxRaw>); + _6 = copy _7 as *const dyn std::ops::FnMut (BoxDerefTransmute); + _5 = &mut (*_6); + _0 = as FnMut>::call_mut(move _5, move _4) -> [return: bb4, unwind: bb2]; diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff index d04dc8f5ff5b2..a8f0bc0dbe6cc 100644 --- a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-abort.diff @@ -10,7 +10,7 @@ + scope 1 (inlined as Fn<(i32,)>>::call) { + let mut _5: &dyn std::ops::Fn(i32); + let mut _6: *const dyn std::ops::Fn(i32); -+ let mut _7: std::ptr::Unique; ++ let mut _7: std::boxed::BoxRaw; + } bb0: { @@ -23,7 +23,7 @@ + StorageLive(_6); + StorageLive(_7); + StorageLive(_5); -+ _7 = no_retag copy ((*_3).0: std::ptr::Unique); ++ _7 = no_retag copy ((*_3).0: std::boxed::BoxRaw); + _6 = copy _7 as *const dyn std::ops::Fn(i32) (BoxDerefTransmute); + _5 = &(*_6); + _2 = >::call(move _5, move _4) -> [return: bb2, unwind unreachable]; diff --git a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff index f2fc8c7388f7d..15dda2556bbc2 100644 --- a/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_box_fn.call.Inline.panic-unwind.diff @@ -10,7 +10,7 @@ + scope 1 (inlined as Fn<(i32,)>>::call) { + let mut _5: &dyn std::ops::Fn(i32); + let mut _6: *const dyn std::ops::Fn(i32); -+ let mut _7: std::ptr::Unique; ++ let mut _7: std::boxed::BoxRaw; + } bb0: { @@ -23,7 +23,7 @@ + StorageLive(_6); + StorageLive(_7); + StorageLive(_5); -+ _7 = no_retag copy ((*_3).0: std::ptr::Unique); ++ _7 = no_retag copy ((*_3).0: std::boxed::BoxRaw); + _6 = copy _7 as *const dyn std::ops::Fn(i32) (BoxDerefTransmute); + _5 = &(*_6); + _2 = >::call(move _5, move _4) -> [return: bb4, unwind: bb2]; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 1d56fa0860654..415c9be599056 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -9,7 +9,7 @@ fn b(_1: &mut Box) -> &mut T { scope 1 (inlined as AsMut>::as_mut) { debug self => _4; let mut _5: *const T; - let mut _6: std::ptr::Unique; + let mut _6: std::boxed::BoxRaw; } bb0: { @@ -19,7 +19,7 @@ fn b(_1: &mut Box) -> &mut T { _4 = no_retag copy _1; StorageLive(_5); StorageLive(_6); - _6 = no_retag copy ((*_4).0: std::ptr::Unique); + _6 = no_retag copy ((*_4).0: std::boxed::BoxRaw); _5 = copy _6 as *const T (BoxDerefTransmute); _3 = &mut (*_5); StorageDead(_6); diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index a74065283737b..e2e2aaf8c45d9 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -8,7 +8,7 @@ fn d(_1: &Box) -> &T { scope 1 (inlined as AsRef>::as_ref) { debug self => _3; let mut _4: *const T; - let mut _5: std::ptr::Unique; + let mut _5: std::boxed::BoxRaw; } bb0: { @@ -17,7 +17,7 @@ fn d(_1: &Box) -> &T { _3 = copy _1; StorageLive(_4); StorageLive(_5); - _5 = no_retag copy ((*_3).0: std::ptr::Unique); + _5 = no_retag copy ((*_3).0: std::boxed::BoxRaw); _4 = copy _5 as *const T (BoxDerefTransmute); _2 = &(*_4); StorageDead(_5); diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff index 6865766499a6a..09a5dc7f2492f 100644 --- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff +++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff @@ -12,7 +12,7 @@ StorageLive(_2); StorageLive(_3); _3 = move _1; - _4 = copy (_3.0: std::ptr::Unique<[i32]>) as *const [i32] (BoxDerefTransmute); + _4 = copy (_3.0: std::boxed::BoxRaw<[i32]>) as *const [i32] (BoxDerefTransmute); _2 = callee(move (*_4)) -> [return: bb1, unwind: bb3]; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff index 3a6a8e137aadc..3107990e21921 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff @@ -17,7 +17,7 @@ } bb1: { - _2 = copy (_1.0: std::ptr::Unique) as *const Never (BoxDerefTransmute); + _2 = copy (_1.0: std::boxed::BoxRaw) as *const Never (BoxDerefTransmute); PlaceMention((*_2)); unreachable; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff index 3a6a8e137aadc..3107990e21921 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -17,7 +17,7 @@ } bb1: { - _2 = copy (_1.0: std::ptr::Unique) as *const Never (BoxDerefTransmute); + _2 = copy (_1.0: std::boxed::BoxRaw) as *const Never (BoxDerefTransmute); PlaceMention((*_2)); unreachable; } diff --git a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-abort.mir index 8384d563e52d2..054477656373e 100644 --- a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-abort.mir @@ -12,15 +12,15 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[u8; 1024]>::cast::) { + scope 19 (inlined boxed::BoxRaw::<[u8; 1024]>::cast::) { let mut _3: std::ptr::NonNull; scope 20 (inlined NonNull::<[u8; 1024]>::cast::) { scope 21 (inlined NonNull::<[u8; 1024]>::as_ptr) { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -38,7 +38,7 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { } } } - scope 6 (inlined std::ptr::Unique::<[u8; 1024]>::as_ptr) { + scope 6 (inlined boxed::BoxRaw::<[u8; 1024]>::as_ptr) { scope 7 (inlined NonNull::<[u8; 1024]>::as_ptr) { } } @@ -70,7 +70,7 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { bb0: { StorageLive(_3); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique<[u8; 1024]>).0: std::ptr::NonNull<[u8; 1024]>); + _2 = copy (((*_1).0: std::boxed::BoxRaw<[u8; 1024]>).0: std::ptr::NonNull<[u8; 1024]>); _3 = copy _2 as std::ptr::NonNull (Transmute); _4 = alloc::alloc::__rust_dealloc(move _3, const 1024_usize, const std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }}) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-unwind.mir index 8384d563e52d2..054477656373e 100644 --- a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.runtime-optimized.after.panic-unwind.mir @@ -12,15 +12,15 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[u8; 1024]>::cast::) { + scope 19 (inlined boxed::BoxRaw::<[u8; 1024]>::cast::) { let mut _3: std::ptr::NonNull; scope 20 (inlined NonNull::<[u8; 1024]>::cast::) { scope 21 (inlined NonNull::<[u8; 1024]>::as_ptr) { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -38,7 +38,7 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { } } } - scope 6 (inlined std::ptr::Unique::<[u8; 1024]>::as_ptr) { + scope 6 (inlined boxed::BoxRaw::<[u8; 1024]>::as_ptr) { scope 7 (inlined NonNull::<[u8; 1024]>::as_ptr) { } } @@ -70,7 +70,7 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { bb0: { StorageLive(_3); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique<[u8; 1024]>).0: std::ptr::NonNull<[u8; 1024]>); + _2 = copy (((*_1).0: std::boxed::BoxRaw<[u8; 1024]>).0: std::ptr::NonNull<[u8; 1024]>); _3 = copy _2 as std::ptr::NonNull (Transmute); _4 = alloc::alloc::__rust_dealloc(move _3, const 1024_usize, const std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }}) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-abort.mir index 3d24aa8c349e7..cc83646ff6c4e 100644 --- a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-abort.mir @@ -12,15 +12,15 @@ fn drop_generic(_1: *mut Box) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::::cast::) { + scope 19 (inlined boxed::BoxRaw::::cast::) { let mut _4: std::ptr::NonNull; scope 20 (inlined NonNull::::cast::) { scope 21 (inlined NonNull::::as_ptr) { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -38,7 +38,7 @@ fn drop_generic(_1: *mut Box) -> () { } } } - scope 6 (inlined std::ptr::Unique::::as_ptr) { + scope 6 (inlined boxed::BoxRaw::::as_ptr) { scope 7 (inlined NonNull::::as_ptr) { } } @@ -71,7 +71,7 @@ fn drop_generic(_1: *mut Box) -> () { bb0: { StorageLive(_4); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique).0: std::ptr::NonNull); + _2 = copy (((*_1).0: std::boxed::BoxRaw).0: std::ptr::NonNull); _3 = const ::ALIGN as std::mem::Alignment (Transmute); switchInt(const ::SIZE) -> [0: bb3, otherwise: bb1]; } diff --git a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-unwind.mir index 3d24aa8c349e7..cc83646ff6c4e 100644 --- a/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_generic.runtime-optimized.after.panic-unwind.mir @@ -12,15 +12,15 @@ fn drop_generic(_1: *mut Box) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::::cast::) { + scope 19 (inlined boxed::BoxRaw::::cast::) { let mut _4: std::ptr::NonNull; scope 20 (inlined NonNull::::cast::) { scope 21 (inlined NonNull::::as_ptr) { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -38,7 +38,7 @@ fn drop_generic(_1: *mut Box) -> () { } } } - scope 6 (inlined std::ptr::Unique::::as_ptr) { + scope 6 (inlined boxed::BoxRaw::::as_ptr) { scope 7 (inlined NonNull::::as_ptr) { } } @@ -71,7 +71,7 @@ fn drop_generic(_1: *mut Box) -> () { bb0: { StorageLive(_4); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique).0: std::ptr::NonNull); + _2 = copy (((*_1).0: std::boxed::BoxRaw).0: std::ptr::NonNull); _3 = const ::ALIGN as std::mem::Alignment (Transmute); switchInt(const ::SIZE) -> [0: bb3, otherwise: bb1]; } diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-abort.mir index 7c0cede85a4ca..243673e0e9f65 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-abort.mir @@ -14,7 +14,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { + scope 19 (inlined boxed::BoxRaw::<[T]>::cast::) { let mut _8: std::ptr::NonNull; scope 20 (inlined NonNull::<[T]>::cast::) { let mut _7: *mut u8; @@ -22,8 +22,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -41,7 +41,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { + scope 6 (inlined boxed::BoxRaw::<[T]>::as_ptr) { scope 7 (inlined NonNull::<[T]>::as_ptr) { } } @@ -77,7 +77,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { StorageLive(_5); StorageLive(_8); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); + _2 = copy (((*_1).0: std::boxed::BoxRaw<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); _3 = copy _2 as *mut [T] (Transmute); _4 = copy _2 as *const [T] (Transmute); diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-unwind.mir index 7c0cede85a4ca..243673e0e9f65 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.32bit.panic-unwind.mir @@ -14,7 +14,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { + scope 19 (inlined boxed::BoxRaw::<[T]>::cast::) { let mut _8: std::ptr::NonNull; scope 20 (inlined NonNull::<[T]>::cast::) { let mut _7: *mut u8; @@ -22,8 +22,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -41,7 +41,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { + scope 6 (inlined boxed::BoxRaw::<[T]>::as_ptr) { scope 7 (inlined NonNull::<[T]>::as_ptr) { } } @@ -77,7 +77,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { StorageLive(_5); StorageLive(_8); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); + _2 = copy (((*_1).0: std::boxed::BoxRaw<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); _3 = copy _2 as *mut [T] (Transmute); _4 = copy _2 as *const [T] (Transmute); diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-abort.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-abort.mir index 7c0cede85a4ca..243673e0e9f65 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-abort.mir @@ -14,7 +14,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { + scope 19 (inlined boxed::BoxRaw::<[T]>::cast::) { let mut _8: std::ptr::NonNull; scope 20 (inlined NonNull::<[T]>::cast::) { let mut _7: *mut u8; @@ -22,8 +22,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -41,7 +41,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { + scope 6 (inlined boxed::BoxRaw::<[T]>::as_ptr) { scope 7 (inlined NonNull::<[T]>::as_ptr) { } } @@ -77,7 +77,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { StorageLive(_5); StorageLive(_8); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); + _2 = copy (((*_1).0: std::boxed::BoxRaw<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); _3 = copy _2 as *mut [T] (Transmute); _4 = copy _2 as *const [T] (Transmute); diff --git a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-unwind.mir b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-unwind.mir index 7c0cede85a4ca..243673e0e9f65 100644 --- a/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/drop_boxed_slice.generic_in_place.runtime-optimized.after.64bit.panic-unwind.mir @@ -14,7 +14,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { scope 5 { scope 18 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { + scope 19 (inlined boxed::BoxRaw::<[T]>::cast::) { let mut _8: std::ptr::NonNull; scope 20 (inlined NonNull::<[T]>::cast::) { let mut _7: *mut u8; @@ -22,8 +22,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 22 (inlined boxed::> for NonNull>::from) { + scope 23 (inlined boxed::BoxRaw::::as_non_null_ptr) { } } scope 24 (inlined ::deallocate) { @@ -41,7 +41,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { + scope 6 (inlined boxed::BoxRaw::<[T]>::as_ptr) { scope 7 (inlined NonNull::<[T]>::as_ptr) { } } @@ -77,7 +77,7 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { StorageLive(_5); StorageLive(_8); StorageLive(_2); - _2 = copy (((*_1).0: std::ptr::Unique<[T]>).0: std::ptr::NonNull<[T]>); + _2 = copy (((*_1).0: std::boxed::BoxRaw<[T]>).0: std::ptr::NonNull<[T]>); StorageLive(_4); _3 = copy _2 as *mut [T] (Transmute); _4 = copy _2 as *const [T] (Transmute); diff --git a/tests/ui/delegation/self-coercion-errors.stderr b/tests/ui/delegation/self-coercion-errors.stderr index 7941940ddcd4c..58f735d282563 100644 --- a/tests/ui/delegation/self-coercion-errors.stderr +++ b/tests/ui/delegation/self-coercion-errors.stderr @@ -941,7 +941,7 @@ LL | reuse Trait::* { self.0 } | | | arguments to this function are incorrect | -note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X6` was accessed through auto-deref instead +note: there is a field `0` on `Box>` with type `boxed::BoxRaw>` but it is private; `0` from `X6` was accessed through auto-deref instead --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | = note: in this struct @@ -1080,7 +1080,7 @@ LL | reuse Trait::* { self.0 } | | | arguments to this function are incorrect | -note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X7` was accessed through auto-deref instead +note: there is a field `0` on `Box>` with type `boxed::BoxRaw>` but it is private; `0` from `X7` was accessed through auto-deref instead --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | = note: in this struct @@ -1115,7 +1115,7 @@ LL | reuse Trait::* { self.0 } | | | arguments to this function are incorrect | -note: there is a field `0` on `Box` with type `std::ptr::Unique` but it is private; `0` from `X8` was accessed through auto-deref instead +note: there is a field `0` on `Box` with type `boxed::BoxRaw` but it is private; `0` from `X8` was accessed through auto-deref instead --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | = note: in this struct @@ -1234,7 +1234,7 @@ LL | reuse Trait::* { self.0 } | | | arguments to this function are incorrect | -note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X8` was accessed through auto-deref instead +note: there is a field `0` on `Box>` with type `boxed::BoxRaw>` but it is private; `0` from `X8` was accessed through auto-deref instead --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | = note: in this struct @@ -1328,7 +1328,7 @@ LL | reuse Trait::* { self.0 } | | | arguments to this function are incorrect | -note: there is a field `0` on `Box` with type `std::ptr::Unique` but it is private; `0` from `X9` was accessed through auto-deref instead +note: there is a field `0` on `Box` with type `boxed::BoxRaw` but it is private; `0` from `X9` was accessed through auto-deref instead --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | = note: in this struct @@ -1468,7 +1468,7 @@ LL | reuse Trait::* { self.0 } | | | arguments to this function are incorrect | -note: there is a field `0` on `Box>` with type `std::ptr::Unique>` but it is private; `0` from `X9` was accessed through auto-deref instead +note: there is a field `0` on `Box>` with type `boxed::BoxRaw>` but it is private; `0` from `X9` was accessed through auto-deref instead --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | = note: in this struct diff --git a/tests/ui/delegation/self-mapping-arguments-errors.stderr b/tests/ui/delegation/self-mapping-arguments-errors.stderr index cd38ad84aeabf..d5cb54ef7ce33 100644 --- a/tests/ui/delegation/self-mapping-arguments-errors.stderr +++ b/tests/ui/delegation/self-mapping-arguments-errors.stderr @@ -89,7 +89,7 @@ LL | reuse impl MyAdd for W { self.0 } | arguments to this function are incorrect | this return type influences the call expression's return type | -note: there is a field `0` on `Box` with type `std::ptr::Unique` but it is private; `0` from `complex_Self_doesnt_map::W` was accessed through auto-deref instead +note: there is a field `0` on `Box` with type `boxed::BoxRaw` but it is private; `0` from `complex_Self_doesnt_map::W` was accessed through auto-deref instead --> $SRC_DIR/alloc/src/boxed.rs:LL:COL | = note: in this struct diff --git a/tests/ui/static/global-variable-promotion-error-7364.stderr b/tests/ui/static/global-variable-promotion-error-7364.stderr index 9f0026621c139..3ef698f85f0aa 100644 --- a/tests/ui/static/global-variable-promotion-error-7364.stderr +++ b/tests/ui/static/global-variable-promotion-error-7364.stderr @@ -6,7 +6,7 @@ LL | static boxed: Box> = Box::new(RefCell::new(0)); | = help: the trait `Sync` is not implemented for `RefCell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` instead - = note: required for `std::ptr::Unique>` to implement `Sync` + = note: required for `boxed::BoxRaw>` to implement `Sync` note: required because it appears within the type `Box>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL = note: shared static variables must have a type that implements `Sync` diff --git a/tests/ui/traits/cycle-cache-err-60010.stderr b/tests/ui/traits/cycle-cache-err-60010.stderr index 4c23e37651e7e..1da1e5c2101a4 100644 --- a/tests/ui/traits/cycle-cache-err-60010.stderr +++ b/tests/ui/traits/cycle-cache-err-60010.stderr @@ -6,8 +6,8 @@ LL | _parse: >::Data, | note: required because it appears within the type `PhantomData` --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `std::ptr::Unique` - --> $SRC_DIR/core/src/ptr/unique.rs:LL:COL +note: required because it appears within the type `boxed::BoxRaw` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required because it appears within the type `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required because it appears within the type `Runtime` @@ -46,8 +46,8 @@ LL | type Storage = SalsaStorage; | note: required because it appears within the type `PhantomData` --> $SRC_DIR/core/src/marker.rs:LL:COL -note: required because it appears within the type `std::ptr::Unique` - --> $SRC_DIR/core/src/ptr/unique.rs:LL:COL +note: required because it appears within the type `boxed::BoxRaw` + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required because it appears within the type `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required because it appears within the type `Runtime` diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr index 64e9dae2633b8..b60798c221c1d 100644 --- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr +++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr @@ -77,12 +77,12 @@ error[E0277]: `dummy2::TestType` cannot be sent between threads safely --> $DIR/negated-auto-traits-error.rs:48:13 | LL | is_send(Box::new(TestType)); - | ------- ^^^^^^^^^^^^^^^^^^ the trait `Send` is not implemented for `std::ptr::Unique` + | ------- ^^^^^^^^^^^^^^^^^^ the trait `Send` is not implemented for `boxed::BoxRaw` | | | required by a bound introduced by this call | - = note: the trait bound `std::ptr::Unique: Send` is not satisfied - = note: required for `std::ptr::Unique` to implement `Send` + = note: the trait bound `boxed::BoxRaw: Send` is not satisfied + = note: required for `boxed::BoxRaw` to implement `Send` note: required because it appears within the type `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required by a bound in `is_send` @@ -113,7 +113,7 @@ note: required because it appears within the type `Outer2` | LL | struct Outer2(T); | ^ required by this field - = note: required for `std::ptr::Unique>` to implement `Send` + = note: required for `boxed::BoxRaw>` to implement `Send` note: required because it appears within the type `Box>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required by a bound in `is_send` diff --git a/tests/ui/traits/send-trait-objects-basic.stderr b/tests/ui/traits/send-trait-objects-basic.stderr index 0393f7bc19df7..1a32a81b9ad96 100644 --- a/tests/ui/traits/send-trait-objects-basic.stderr +++ b/tests/ui/traits/send-trait-objects-basic.stderr @@ -19,7 +19,7 @@ LL | assert_send_static::>(); | ^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `(dyn Dummy + 'a)` - = note: required for `std::ptr::Unique<(dyn Dummy + 'a)>` to implement `Send` + = note: required for `boxed::BoxRaw<(dyn Dummy + 'a)>` to implement `Send` note: required because it appears within the type `Box<(dyn Dummy + 'a)>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required by a bound in `assert_send_static` @@ -62,7 +62,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `dyn Dummy` - = note: required for `std::ptr::Unique` to implement `Send` + = note: required for `boxed::BoxRaw` to implement `Send` note: required because it appears within the type `Box` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required by a bound in `assert_send` @@ -78,7 +78,7 @@ LL | assert_send::>(); | ^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `*mut u8` - = note: required for `std::ptr::Unique<*mut u8>` to implement `Send` + = note: required for `boxed::BoxRaw<*mut u8>` to implement `Send` note: required because it appears within the type `Box<*mut u8>` --> $SRC_DIR/alloc/src/boxed.rs:LL:COL note: required by a bound in `assert_send` diff --git a/tests/ui/typeck/issue-82772.rs b/tests/ui/typeck/issue-82772.rs index b620eee430765..fa7507f1b5a24 100644 --- a/tests/ui/typeck/issue-82772.rs +++ b/tests/ui/typeck/issue-82772.rs @@ -3,6 +3,8 @@ fn main() { use a::ModPrivateStruct; let Box { 0: _, .. }: Box<()>; //~ ERROR field `0` of + //~^ ERROR type `boxed::BoxRaw<()>` is private + let Box { 1: _, .. }: Box<()>; //~ ERROR field `1` of let ModPrivateStruct { 1: _, .. } = ModPrivateStruct::default(); //~ ERROR field `1` of } diff --git a/tests/ui/typeck/issue-82772.stderr b/tests/ui/typeck/issue-82772.stderr index a314306137a48..7a15ef68bdca7 100644 --- a/tests/ui/typeck/issue-82772.stderr +++ b/tests/ui/typeck/issue-82772.stderr @@ -5,17 +5,23 @@ LL | let Box { 0: _, .. }: Box<()>; | ^ private field error[E0451]: field `1` of struct `Box` is private - --> $DIR/issue-82772.rs:6:15 + --> $DIR/issue-82772.rs:8:15 | LL | let Box { 1: _, .. }: Box<()>; | ^ private field error[E0451]: field `1` of struct `ModPrivateStruct` is private - --> $DIR/issue-82772.rs:7:28 + --> $DIR/issue-82772.rs:9:28 | LL | let ModPrivateStruct { 1: _, .. } = ModPrivateStruct::default(); | ^ private field -error: aborting due to 3 previous errors +error: type `boxed::BoxRaw<()>` is private + --> $DIR/issue-82772.rs:5:18 + | +LL | let Box { 0: _, .. }: Box<()>; + | ^ private type + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0451`.