Rollup merge of #48110 - Centril:stabilize/box_leak, r=alexcrichton
Stabilize Box::leak Stabilizes the following: + `Box::leak` (`box_leak`, in nightly since 2017-11-23) cc #46179 r? @rust-lang/libs
This commit is contained in:
@@ -359,8 +359,6 @@ impl<T: ?Sized> Box<T> {
|
|||||||
/// Simple usage:
|
/// Simple usage:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(box_leak)]
|
|
||||||
///
|
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let x = Box::new(41);
|
/// let x = Box::new(41);
|
||||||
/// let static_ref: &'static mut usize = Box::leak(x);
|
/// let static_ref: &'static mut usize = Box::leak(x);
|
||||||
@@ -372,8 +370,6 @@ impl<T: ?Sized> Box<T> {
|
|||||||
/// Unsized data:
|
/// Unsized data:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(box_leak)]
|
|
||||||
///
|
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let x = vec![1, 2, 3].into_boxed_slice();
|
/// let x = vec![1, 2, 3].into_boxed_slice();
|
||||||
/// let static_ref = Box::leak(x);
|
/// let static_ref = Box::leak(x);
|
||||||
@@ -381,8 +377,7 @@ impl<T: ?Sized> Box<T> {
|
|||||||
/// assert_eq!(*static_ref, [4, 2, 3]);
|
/// assert_eq!(*static_ref, [4, 2, 3]);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "box_leak", reason = "needs an FCP to stabilize",
|
#[stable(feature = "box_leak", since = "1.26.0")]
|
||||||
issue = "46179")]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn leak<'a>(b: Box<T>) -> &'a mut T
|
pub fn leak<'a>(b: Box<T>) -> &'a mut T
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user