diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs index fecd3865b3b32..2e22929056a22 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 ce36a9324b119..80172d058527f 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,27 @@ pub use iter::BoxedArrayIntoIter; #[unstable(feature = "thin_box", issue = "92791")] pub use thin::ThinBox; +/// An internal wrapper type 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. +#[repr(transparent)] +struct BoxRaw { + pointer: NonNull, + _marker: PhantomData, +} +impl Clone for BoxRaw { + #[inline] + fn clone(&self) -> Self { + *self + } +} +impl Copy for BoxRaw {} +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 {} + /// 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 +257,7 @@ pub use thin::ThinBox; pub struct Box< T: ?Sized, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, ->(Unique, A); +>(BoxRaw, A); /// Monomorphic function for allocating an uninit `Box`. #[inline] @@ -1575,7 +1596,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) + unsafe { Box(BoxRaw { pointer: NonNull::new_unchecked(raw), _marker: PhantomData }, alloc) } } /// Constructs a box from a `NonNull` pointer in the given allocator. @@ -2000,7 +2021,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box { fn drop(&mut self) { // the T in the Box is dropped by the compiler before the destructor is run - let ptr = self.0; + let ptr = self.0.pointer; // SAFETY: The construction site of the unsized box had ensured for us that the // allocation was made with a valid layout (the size does not overflow an isize, @@ -2011,7 +2032,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box { // of this box and `layout` would fit that allocation. We also are the only ones // responsible for doing this deallocation and know that the pointer must be valid. unsafe { - self.1.deallocate(From::from(ptr.cast()), layout); + self.1.deallocate(ptr.cast(), layout); } } } @@ -2045,8 +2066,11 @@ impl Default for Box<[T]> { /// Creates an empty `[T]` inside a `Box`. #[inline] fn default() -> Self { - let ptr: Unique<[T]> = Unique::<[T; 0]>::dangling(); - Box(ptr, Global) + // SAFETY: `[T; 0]` is a ZST, for which `dangling` is valid + Box( + BoxRaw { pointer: NonNull::<[T; 0]>::dangling(), _marker: core::marker::PhantomData }, + Global, + ) } } @@ -2055,12 +2079,8 @@ 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) - }; - Box(ptr, Global) + // SAFETY: The empty byte slice is valid UTF-8 + unsafe { crate::str::from_boxed_utf8_unchecked(Box::default()) } } } diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_free_while_queued.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_free_while_queued.stderr index ae37c89406bb3..fdda604918809 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_free_while_queued.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_free_while_queued.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation of `pthread_mutex_t` is forbidden while the queue is non-empty --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/src/tools/miri/tests/fail/alloc/stack_free.stderr b/src/tools/miri/tests/fail/alloc/stack_free.stderr index 70fc61964df5c..cfc4e1b51acf6 100644 --- a/src/tools/miri/tests/fail/alloc/stack_free.stderr +++ b/src/tools/miri/tests/fail/alloc/stack_free.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocating ALLOC, which is stack variable memory, using Rust heap deallocation operation --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information diff --git a/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.stack.stderr b/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.stack.stderr index b8a763a5fc3f4..a65f94e47e8f9 100644 --- a/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.stack.stderr +++ b/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.stack.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocating while item [Unique for ] is strongly protected --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information diff --git a/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.tree.stderr index 3e97a15333ac6..2625da88cfb9b 100644 --- a/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/deallocate_against_protector1.tree.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information 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..f93d0d546d110 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,8 +1,8 @@ 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) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | unsafe { Box(BoxRaw { pointer: NonNull::new_unchecked(raw), _marker: PhantomData }, 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 = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr index 58c43ebe4aeea..b986c061dd9fa 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information 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..a4ed3e283c079 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,8 +1,8 @@ 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) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | unsafe { Box(BoxRaw { pointer: NonNull::new_unchecked(raw), _marker: PhantomData }, 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 = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr index a5b66643144ec..a0a67772abe50 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information diff --git a/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr b/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr index 9af0414ce6061..727cbd70eee3b 100644 --- a/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information diff --git a/src/tools/miri/tests/fail/tree_borrows/wildcard/strongly_protected_wildcard.stderr b/src/tools/miri/tests/fail/tree_borrows/wildcard/strongly_protected_wildcard.stderr index e6c68dd3de92f..75f5018d9e1a3 100644 --- a/src/tools/miri/tests/fail/tree_borrows/wildcard/strongly_protected_wildcard.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/wildcard/strongly_protected_wildcard.stderr @@ -1,8 +1,8 @@ error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information diff --git a/src/tools/miri/tests/pass/alloc-access-tracking.stderr b/src/tools/miri/tests/pass/alloc-access-tracking.stderr index bcc1d987330ab..46de731c8aae8 100644 --- a/src/tools/miri/tests/pass/alloc-access-tracking.stderr +++ b/src/tools/miri/tests/pass/alloc-access-tracking.stderr @@ -19,8 +19,8 @@ LL | assert_eq!(*ptr, 42); note: freed allocation ALLOC --> RUSTLIB/alloc/src/boxed.rs:LL:CC | -LL | self.1.deallocate(From::from(ptr.cast()), layout); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tracking was triggered here +LL | self.1.deallocate(ptr.cast(), layout); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tracking was triggered here | = note: stack backtrace: 0: > as std::ops::Drop>::drop 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..8cbda61d14883 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..be4b90d731052 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,13 +31,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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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: ALLOC1, 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: ALLOC2, 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: ALLOC3, 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]; @@ -53,6 +49,8 @@ } } + ALLOC3 (size: 8, align: 4) { .. } + ALLOC2 (size: 8, align: 4) { .. } ALLOC1 (size: 8, align: 4) { .. } 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..086fe1fbbcb46 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,13 +31,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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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: ALLOC1, 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: ALLOC2, 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: ALLOC3, 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]; @@ -57,6 +53,8 @@ } } + ALLOC3 (size: 8, align: 4) { .. } + ALLOC2 (size: 8, align: 4) { .. } ALLOC1 (size: 8, align: 4) { .. } 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..3d77ccce5c904 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,13 +31,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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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: ALLOC1, 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: ALLOC2, 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: ALLOC3, 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]; @@ -53,6 +49,8 @@ } } + ALLOC3 (size: 16, align: 8) { .. } + ALLOC2 (size: 16, align: 8) { .. } ALLOC1 (size: 16, align: 8) { .. } 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..f854ee66f8cec 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,13 +31,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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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: ALLOC1, 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: ALLOC2, 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: ALLOC3, 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]; @@ -57,6 +53,8 @@ } } + ALLOC3 (size: 16, align: 8) { .. } + ALLOC2 (size: 16, align: 8) { .. } ALLOC1 (size: 16, align: 8) { .. } 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..a237a8ea80406 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,18 +31,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 = move _5 as std::ptr::NonNull<[bool]> (PointerCoercion(Unsize, Implicit)); + _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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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 = boxed::BoxRaw::<[bool]> { pointer: move _4, _marker: const PhantomData::<[bool]> }; ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, 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 = Box::<[bool]>(move _3, const std::alloc::Global); ++ _2 = const 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(_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: ALLOC3, 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]; @@ -58,6 +54,8 @@ } } + ++ ALLOC3 (size: 8, align: 4) { .. } ++ + ALLOC2 (size: 8, align: 4) { .. } + + ALLOC1 (size: 8, align: 4) { .. } 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..481a55dea6f1c 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,18 +31,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 = move _5 as std::ptr::NonNull<[bool]> (PointerCoercion(Unsize, Implicit)); + _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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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 = boxed::BoxRaw::<[bool]> { pointer: move _4, _marker: const PhantomData::<[bool]> }; ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, 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 = Box::<[bool]>(move _3, const std::alloc::Global); ++ _2 = const 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(_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: ALLOC3, 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]; @@ -62,6 +58,8 @@ } } + ++ ALLOC3 (size: 8, align: 4) { .. } ++ + ALLOC2 (size: 8, align: 4) { .. } + + ALLOC1 (size: 8, align: 4) { .. } 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..7f206941995f6 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,18 +31,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 = move _5 as std::ptr::NonNull<[bool]> (PointerCoercion(Unsize, Implicit)); + _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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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 = boxed::BoxRaw::<[bool]> { pointer: move _4, _marker: const PhantomData::<[bool]> }; ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, 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 = Box::<[bool]>(move _3, const std::alloc::Global); ++ _2 = const 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(_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: ALLOC3, 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]; @@ -58,6 +54,8 @@ } } + ++ ALLOC3 (size: 16, align: 8) { .. } ++ + ALLOC2 (size: 16, align: 8) { .. } + + ALLOC1 (size: 16, align: 8) { .. } 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..ae8e492a13793 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,22 +9,18 @@ debug a => _1; } scope 2 (inlined as Default>::default) { - let _3: std::ptr::Unique<[bool]>; - let mut _4: std::ptr::Unique<[bool; 0]>; - scope 3 { - } - scope 4 (inlined std::ptr::Unique::<[bool; 0]>::dangling) { - let mut _5: std::ptr::NonNull<[bool; 0]>; - scope 5 (inlined NonNull::<[bool; 0]>::dangling) { - scope 6 { - scope 8 (inlined std::mem::Alignment::as_nonzero_usize) { - } - scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) { - } + let mut _3: std::boxed::BoxRaw<[bool]>; + let mut _4: std::ptr::NonNull<[bool]>; + let mut _5: std::ptr::NonNull<[bool; 0]>; + scope 3 (inlined NonNull::<[bool; 0]>::dangling) { + scope 4 { + scope 6 (inlined std::mem::Alignment::as_nonzero_usize) { } - scope 7 (inlined std::mem::Alignment::of::<[bool; 0]>) { + scope 7 (inlined NonNull::<[bool; 0]>::without_provenance) { } } + scope 5 (inlined std::mem::Alignment::of::<[bool; 0]>) { + } } } @@ -35,18 +31,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 = move _5 as std::ptr::NonNull<[bool]> (PointerCoercion(Unsize, Implicit)); + _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 NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: pattern_type!(*const [bool] is !null) }}; 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 = boxed::BoxRaw::<[bool]> { pointer: move _4, _marker: const PhantomData::<[bool]> }; ++ _3 = const boxed::BoxRaw::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, 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 = Box::<[bool]>(move _3, const std::alloc::Global); ++ _2 = const 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(_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: ALLOC3, 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]; @@ -62,6 +58,8 @@ } } + ++ ALLOC3 (size: 16, align: 8) { .. } ++ + ALLOC2 (size: 16, align: 8) { .. } + + ALLOC1 (size: 16, align: 8) { .. } 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..2b19890982ffc 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 @@ -7,58 +7,50 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { scope 2 (inlined std::ptr::drop_glue::> - shim(Some(Box<[u8; 1024]>))) { scope 3 (inlined as Drop>::drop) { let _2: std::ptr::NonNull<[u8; 1024]>; + let mut _3: std::ptr::NonNull; let _4: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[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 18 (inlined NonNull::<[u8; 1024]>::cast::) { + scope 19 (inlined NonNull::<[u8; 1024]>::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::<[u8; 1024]>::as_ptr) { - scope 7 (inlined NonNull::<[u8; 1024]>::as_ptr) { - } + scope 6 (inlined NonNull::<[u8; 1024]>::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::<[u8; 1024]>) { - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 7 (inlined Layout::for_value_raw::<[u8; 1024]>) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::<[u8; 1024]>) { + scope 9 (inlined size_of_val_raw::<[u8; 1024]>) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::<[u8; 1024]>) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::<[u8; 1024]>) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::<[u8; 1024]>) { + scope 12 (inlined align_of_val_raw::<[u8; 1024]>) { } } } @@ -68,16 +60,16 @@ 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]>); + StorageLive(_3); _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]; } bb1: { - StorageDead(_2); StorageDead(_3); + StorageDead(_2); return; } } 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..2b19890982ffc 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 @@ -7,58 +7,50 @@ fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () { scope 2 (inlined std::ptr::drop_glue::> - shim(Some(Box<[u8; 1024]>))) { scope 3 (inlined as Drop>::drop) { let _2: std::ptr::NonNull<[u8; 1024]>; + let mut _3: std::ptr::NonNull; let _4: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[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 18 (inlined NonNull::<[u8; 1024]>::cast::) { + scope 19 (inlined NonNull::<[u8; 1024]>::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::<[u8; 1024]>::as_ptr) { - scope 7 (inlined NonNull::<[u8; 1024]>::as_ptr) { - } + scope 6 (inlined NonNull::<[u8; 1024]>::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::<[u8; 1024]>) { - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 7 (inlined Layout::for_value_raw::<[u8; 1024]>) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::<[u8; 1024]>) { + scope 9 (inlined size_of_val_raw::<[u8; 1024]>) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::<[u8; 1024]>) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::<[u8; 1024]>) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::<[u8; 1024]>) { + scope 12 (inlined align_of_val_raw::<[u8; 1024]>) { } } } @@ -68,16 +60,16 @@ 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]>); + StorageLive(_3); _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]; } bb1: { - StorageDead(_2); StorageDead(_3); + StorageDead(_2); return; } } 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..bd10e2e28f7bf 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 @@ -7,59 +7,51 @@ fn drop_generic(_1: *mut Box) -> () { scope 2 (inlined std::ptr::drop_glue::> - shim(Some(Box))) { scope 3 (inlined as Drop>::drop) { let _2: std::ptr::NonNull; + let mut _4: std::ptr::NonNull; let _5: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::::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 18 (inlined NonNull::::cast::) { + scope 19 (inlined NonNull::::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::::as_ptr) { - scope 7 (inlined NonNull::::as_ptr) { - } + scope 6 (inlined NonNull::::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::) { + scope 7 (inlined Layout::for_value_raw::) { let mut _3: std::mem::Alignment; - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::) { + scope 9 (inlined size_of_val_raw::) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::) { + scope 12 (inlined align_of_val_raw::) { } } } @@ -69,14 +61,14 @@ 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]; + switchInt(const ::SIZE) -> [0: bb4, otherwise: bb1]; } bb1: { + StorageLive(_4); _4 = copy _2 as std::ptr::NonNull (Transmute); switchInt(const ::SIZE) -> [0: bb3, otherwise: bb2]; } @@ -86,8 +78,12 @@ fn drop_generic(_1: *mut Box) -> () { } bb3: { - StorageDead(_2); StorageDead(_4); + goto -> bb4; + } + + bb4: { + StorageDead(_2); return; } } 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..bd10e2e28f7bf 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 @@ -7,59 +7,51 @@ fn drop_generic(_1: *mut Box) -> () { scope 2 (inlined std::ptr::drop_glue::> - shim(Some(Box))) { scope 3 (inlined as Drop>::drop) { let _2: std::ptr::NonNull; + let mut _4: std::ptr::NonNull; let _5: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::::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 18 (inlined NonNull::::cast::) { + scope 19 (inlined NonNull::::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::::as_ptr) { - scope 7 (inlined NonNull::::as_ptr) { - } + scope 6 (inlined NonNull::::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::) { + scope 7 (inlined Layout::for_value_raw::) { let mut _3: std::mem::Alignment; - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::) { + scope 9 (inlined size_of_val_raw::) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::) { + scope 12 (inlined align_of_val_raw::) { } } } @@ -69,14 +61,14 @@ 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]; + switchInt(const ::SIZE) -> [0: bb4, otherwise: bb1]; } bb1: { + StorageLive(_4); _4 = copy _2 as std::ptr::NonNull (Transmute); switchInt(const ::SIZE) -> [0: bb3, otherwise: bb2]; } @@ -86,8 +78,12 @@ fn drop_generic(_1: *mut Box) -> () { } bb3: { - StorageDead(_2); StorageDead(_4); + goto -> bb4; + } + + bb4: { + StorageDead(_2); return; } } 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..ba7d784579f3a 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 @@ -9,61 +9,53 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; + let mut _8: std::ptr::NonNull; let _9: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { - let mut _8: std::ptr::NonNull; - scope 20 (inlined NonNull::<[T]>::cast::) { - let mut _7: *mut u8; - scope 21 (inlined NonNull::<[T]>::as_ptr) { - } - } - } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 18 (inlined NonNull::<[T]>::cast::) { + let mut _7: *mut u8; + scope 19 (inlined NonNull::<[T]>::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { - scope 7 (inlined NonNull::<[T]>::as_ptr) { - } + scope 6 (inlined NonNull::<[T]>::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::<[T]>) { + scope 7 (inlined Layout::for_value_raw::<[T]>) { let mut _5: usize; let mut _6: std::mem::Alignment; - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::<[T]>) { + scope 9 (inlined size_of_val_raw::<[T]>) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::<[T]>) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::<[T]>) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::<[T]>) { + scope 12 (inlined align_of_val_raw::<[T]>) { } } } @@ -75,9 +67,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb0: { StorageLive(_3); 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); @@ -87,10 +78,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = const ::ALIGN as std::mem::Alignment (Transmute); StorageDead(_4); - switchInt(copy _5) -> [0: bb3, otherwise: bb2]; + switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { + StorageLive(_8); StorageLive(_7); _7 = copy _3 as *mut u8 (PtrToPtr); _8 = copy _7 as std::ptr::NonNull (Transmute); @@ -99,8 +91,12 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb3: { - StorageDead(_2); StorageDead(_8); + goto -> bb4; + } + + bb4: { + StorageDead(_2); StorageDead(_5); StorageDead(_3); return; 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..ba7d784579f3a 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 @@ -9,61 +9,53 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; + let mut _8: std::ptr::NonNull; let _9: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { - let mut _8: std::ptr::NonNull; - scope 20 (inlined NonNull::<[T]>::cast::) { - let mut _7: *mut u8; - scope 21 (inlined NonNull::<[T]>::as_ptr) { - } - } - } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 18 (inlined NonNull::<[T]>::cast::) { + let mut _7: *mut u8; + scope 19 (inlined NonNull::<[T]>::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { - scope 7 (inlined NonNull::<[T]>::as_ptr) { - } + scope 6 (inlined NonNull::<[T]>::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::<[T]>) { + scope 7 (inlined Layout::for_value_raw::<[T]>) { let mut _5: usize; let mut _6: std::mem::Alignment; - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::<[T]>) { + scope 9 (inlined size_of_val_raw::<[T]>) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::<[T]>) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::<[T]>) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::<[T]>) { + scope 12 (inlined align_of_val_raw::<[T]>) { } } } @@ -75,9 +67,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb0: { StorageLive(_3); 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); @@ -87,10 +78,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = const ::ALIGN as std::mem::Alignment (Transmute); StorageDead(_4); - switchInt(copy _5) -> [0: bb3, otherwise: bb2]; + switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { + StorageLive(_8); StorageLive(_7); _7 = copy _3 as *mut u8 (PtrToPtr); _8 = copy _7 as std::ptr::NonNull (Transmute); @@ -99,8 +91,12 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb3: { - StorageDead(_2); StorageDead(_8); + goto -> bb4; + } + + bb4: { + StorageDead(_2); StorageDead(_5); StorageDead(_3); return; 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..ba7d784579f3a 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 @@ -9,61 +9,53 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; + let mut _8: std::ptr::NonNull; let _9: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { - let mut _8: std::ptr::NonNull; - scope 20 (inlined NonNull::<[T]>::cast::) { - let mut _7: *mut u8; - scope 21 (inlined NonNull::<[T]>::as_ptr) { - } - } - } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 18 (inlined NonNull::<[T]>::cast::) { + let mut _7: *mut u8; + scope 19 (inlined NonNull::<[T]>::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { - scope 7 (inlined NonNull::<[T]>::as_ptr) { - } + scope 6 (inlined NonNull::<[T]>::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::<[T]>) { + scope 7 (inlined Layout::for_value_raw::<[T]>) { let mut _5: usize; let mut _6: std::mem::Alignment; - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::<[T]>) { + scope 9 (inlined size_of_val_raw::<[T]>) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::<[T]>) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::<[T]>) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::<[T]>) { + scope 12 (inlined align_of_val_raw::<[T]>) { } } } @@ -75,9 +67,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb0: { StorageLive(_3); 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); @@ -87,10 +78,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = const ::ALIGN as std::mem::Alignment (Transmute); StorageDead(_4); - switchInt(copy _5) -> [0: bb3, otherwise: bb2]; + switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { + StorageLive(_8); StorageLive(_7); _7 = copy _3 as *mut u8 (PtrToPtr); _8 = copy _7 as std::ptr::NonNull (Transmute); @@ -99,8 +91,12 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb3: { - StorageDead(_2); StorageDead(_8); + goto -> bb4; + } + + bb4: { + StorageDead(_2); StorageDead(_5); StorageDead(_3); return; 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..ba7d784579f3a 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 @@ -9,61 +9,53 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { let _2: std::ptr::NonNull<[T]>; let mut _3: *mut [T]; let mut _4: *const [T]; + let mut _8: std::ptr::NonNull; let _9: (); scope 4 { scope 5 { - scope 18 (inlined Layout::size) { + scope 17 (inlined Layout::size) { } - scope 19 (inlined std::ptr::Unique::<[T]>::cast::) { - let mut _8: std::ptr::NonNull; - scope 20 (inlined NonNull::<[T]>::cast::) { - let mut _7: *mut u8; - scope 21 (inlined NonNull::<[T]>::as_ptr) { - } - } - } - scope 22 (inlined as From>>::from) { - scope 23 (inlined std::ptr::Unique::::as_non_null_ptr) { + scope 18 (inlined NonNull::<[T]>::cast::) { + let mut _7: *mut u8; + scope 19 (inlined NonNull::<[T]>::as_ptr) { } } - scope 24 (inlined ::deallocate) { - scope 25 (inlined std::alloc::Global::deallocate_impl) { - scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) { - scope 27 (inlined Layout::size) { + scope 20 (inlined ::deallocate) { + scope 21 (inlined std::alloc::Global::deallocate_impl) { + scope 22 (inlined std::alloc::Global::deallocate_impl_runtime) { + scope 23 (inlined Layout::size) { } - scope 28 (inlined alloc::alloc::dealloc_nonnull) { - scope 29 (inlined Layout::size) { + scope 24 (inlined alloc::alloc::dealloc_nonnull) { + scope 25 (inlined Layout::size) { } - scope 30 (inlined Layout::alignment) { + scope 26 (inlined Layout::alignment) { } } } } } } - scope 6 (inlined std::ptr::Unique::<[T]>::as_ptr) { - scope 7 (inlined NonNull::<[T]>::as_ptr) { - } + scope 6 (inlined NonNull::<[T]>::as_ptr) { } - scope 8 (inlined Layout::for_value_raw::<[T]>) { + scope 7 (inlined Layout::for_value_raw::<[T]>) { let mut _5: usize; let mut _6: std::mem::Alignment; - scope 9 { - scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { + scope 8 { + scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) { } } - scope 10 (inlined size_of_val_raw::<[T]>) { + scope 9 (inlined size_of_val_raw::<[T]>) { } - scope 11 (inlined std::mem::Alignment::of_val_raw::<[T]>) { - scope 12 { - scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { - scope 15 (inlined core::ub_checks::check_language_ub) { - scope 16 (inlined core::ub_checks::check_language_ub::runtime) { + scope 10 (inlined std::mem::Alignment::of_val_raw::<[T]>) { + scope 11 { + scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) { + scope 14 (inlined core::ub_checks::check_language_ub) { + scope 15 (inlined core::ub_checks::check_language_ub::runtime) { } } } } - scope 13 (inlined align_of_val_raw::<[T]>) { + scope 12 (inlined align_of_val_raw::<[T]>) { } } } @@ -75,9 +67,8 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb0: { StorageLive(_3); 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); @@ -87,10 +78,11 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { bb1: { _6 = const ::ALIGN as std::mem::Alignment (Transmute); StorageDead(_4); - switchInt(copy _5) -> [0: bb3, otherwise: bb2]; + switchInt(copy _5) -> [0: bb4, otherwise: bb2]; } bb2: { + StorageLive(_8); StorageLive(_7); _7 = copy _3 as *mut u8 (PtrToPtr); _8 = copy _7 as std::ptr::NonNull (Transmute); @@ -99,8 +91,12 @@ fn generic_in_place(_1: *mut Box<[T]>) -> () { } bb3: { - StorageDead(_2); StorageDead(_8); + goto -> bb4; + } + + bb4: { + StorageDead(_2); StorageDead(_5); StorageDead(_3); return; diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir index 549af7af4d888..b42087b5c822d 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.runtime-optimized.after.panic-abort.mir @@ -21,7 +21,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug x => _34; } scope 18 (inlined > as Iterator>::next) { - let mut _22: std::option::Option; + let mut _22: std::option::Option; let mut _27: std::option::Option<&T>; let mut _30: (usize, bool); let mut _31: (usize, &T); @@ -32,7 +32,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } scope 20 { scope 21 { - scope 27 (inlined as FromResidual>>::from_residual) { + scope 27 (inlined as FromResidual>>::from_residual) { let mut _21: isize; let mut _23: bool; } 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 9665d5badf599..15bc8ecdcd39f 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` @@ -45,8 +45,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 b7d8484e1041e..3ceba0a2e3f71 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); | ^^^^^^ - = 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`.