We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac178fc commit e3c5921Copy full SHA for e3c5921
library/alloc/src/boxed.rs
@@ -1150,8 +1150,9 @@ impl<T: ?Sized> Box<T> {
1150
#[stable(feature = "box_raw", since = "1.4.0")]
1151
#[inline]
1152
pub fn into_raw(b: Self) -> *mut T {
1153
- // Make sure Miri realizes that we transition from a noalias pointer to a raw pointer here.
1154
- unsafe { &raw mut *&mut *Self::into_raw_with_allocator(b).0 }
+ // Avoid `into_raw_with_allocator` as that interacts poorly with Miri's Stacked Borrows.
+ let mut b = mem::ManuallyDrop::new(b);
1155
+ &raw mut **b
1156
}
1157
1158
/// Consumes the `Box`, returning a wrapped `NonNull` pointer.
0 commit comments