Skip to content

Commit ea6944a

Browse files
committed
Address ThinBox::try_new PR review
1 parent 3c880f2 commit ea6944a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

library/alloc/src/boxed/thin.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,19 @@ impl<T> ThinBox<T> {
6767
let ptr = WithOpaqueHeader::new(meta, value);
6868
ThinBox { ptr, _marker: PhantomData }
6969
}
70-
}
7170

72-
#[unstable(feature = "thin_box", issue = "92791")]
73-
impl<T> ThinBox<T> {
7471
/// Moves a type to the heap with its [`Metadata`] stored in the heap allocation instead of on
7572
/// the stack. Returns an error if allocation fails, instead of aborting.
7673
///
7774
/// # Examples
7875
///
7976
/// ```
77+
/// #![feature(allocator_api)]
8078
/// #![feature(thin_box)]
8179
/// use std::boxed::ThinBox;
8280
///
83-
/// let five = ThinBox::new(5);
81+
/// let five = ThinBox::try_new(5)?;
82+
/// # Ok::<(), std::alloc::AllocError>(())
8483
/// ```
8584
///
8685
/// [`Metadata`]: core::ptr::Pointee::Metadata

0 commit comments

Comments
 (0)