From ea6944a065bdc64855c221f8e2fd969df4d21c6d Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 11 Feb 2024 11:15:21 -0800 Subject: Address ThinBox::try_new PR review --- library/alloc/src/boxed/thin.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'library/alloc') diff --git a/library/alloc/src/boxed/thin.rs b/library/alloc/src/boxed/thin.rs index b210f3ee572..727d7143ff7 100644 --- a/library/alloc/src/boxed/thin.rs +++ b/library/alloc/src/boxed/thin.rs @@ -67,20 +67,19 @@ impl ThinBox { let ptr = WithOpaqueHeader::new(meta, value); ThinBox { ptr, _marker: PhantomData } } -} -#[unstable(feature = "thin_box", issue = "92791")] -impl ThinBox { /// Moves a type to the heap with its [`Metadata`] stored in the heap allocation instead of on /// the stack. Returns an error if allocation fails, instead of aborting. /// /// # Examples /// /// ``` + /// #![feature(allocator_api)] /// #![feature(thin_box)] /// use std::boxed::ThinBox; /// - /// let five = ThinBox::new(5); + /// let five = ThinBox::try_new(5)?; + /// # Ok::<(), std::alloc::AllocError>(()) /// ``` /// /// [`Metadata`]: core::ptr::Pointee::Metadata -- cgit 1.4.1-3-g733a5