@@ -143,7 +143,7 @@ use core::ops::{
143
143
CoerceUnsized , Deref , DerefMut , DispatchFromDyn , Generator , GeneratorState , Receiver ,
144
144
} ;
145
145
use core:: pin:: Pin ;
146
- use core:: ptr:: { self , NonNull , Unique } ;
146
+ use core:: ptr:: { self , Unique } ;
147
147
use core:: task:: { Context , Poll } ;
148
148
149
149
use crate :: alloc:: { self , AllocInit , AllocRef , Global } ;
@@ -451,50 +451,6 @@ impl<T: ?Sized> Box<T> {
451
451
Box :: leak ( b) as * mut T
452
452
}
453
453
454
- /// Consumes the `Box`, returning the wrapped pointer as `NonNull<T>`.
455
- ///
456
- /// After calling this function, the caller is responsible for the
457
- /// memory previously managed by the `Box`. In particular, the
458
- /// caller should properly destroy `T` and release the memory. The
459
- /// easiest way to do so is to convert the `NonNull<T>` pointer
460
- /// into a raw pointer and back into a `Box` with the [`Box::from_raw`]
461
- /// function.
462
- ///
463
- /// Note: this is an associated function, which means that you have
464
- /// to call it as `Box::into_raw_non_null(b)`
465
- /// instead of `b.into_raw_non_null()`. This
466
- /// is so that there is no conflict with a method on the inner type.
467
- ///
468
- /// [`Box::from_raw`]: struct.Box.html#method.from_raw
469
- ///
470
- /// # Examples
471
- ///
472
- /// ```
473
- /// #![feature(box_into_raw_non_null)]
474
- /// #![allow(deprecated)]
475
- ///
476
- /// let x = Box::new(5);
477
- /// let ptr = Box::into_raw_non_null(x);
478
- ///
479
- /// // Clean up the memory by converting the NonNull pointer back
480
- /// // into a Box and letting the Box be dropped.
481
- /// let x = unsafe { Box::from_raw(ptr.as_ptr()) };
482
- /// ```
483
- #[ unstable( feature = "box_into_raw_non_null" , issue = "47336" ) ]
484
- #[ rustc_deprecated(
485
- since = "1.44.0" ,
486
- reason = "use `Box::leak(b).into()` or `NonNull::from(Box::leak(b))` instead"
487
- ) ]
488
- #[ inline]
489
- pub fn into_raw_non_null ( b : Box < T > ) -> NonNull < T > {
490
- // Box is recognized as a "unique pointer" by Stacked Borrows, but internally it is a
491
- // raw pointer for the type system. Turning it directly into a raw pointer would not be
492
- // recognized as "releasing" the unique pointer to permit aliased raw accesses,
493
- // so all raw pointer methods go through `leak` which creates a (unique)
494
- // mutable reference. Turning *that* to a raw pointer behaves correctly.
495
- Box :: leak ( b) . into ( )
496
- }
497
-
498
454
#[ unstable(
499
455
feature = "ptr_internals" ,
500
456
issue = "none" ,
0 commit comments