diff options
| author | David Tolnay <dtolnay@gmail.com> | 2024-02-11 11:15:21 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2024-02-11 11:28:01 -0800 |
| commit | ea6944a065bdc64855c221f8e2fd969df4d21c6d (patch) | |
| tree | ad42ba005ea343941b730e211179cbacaa5230f3 | |
| parent | 3c880f2405cbb0b54a20ce192a005b11744f8960 (diff) | |
| download | rust-ea6944a065bdc64855c221f8e2fd969df4d21c6d.tar.gz rust-ea6944a065bdc64855c221f8e2fd969df4d21c6d.zip | |
Address ThinBox::try_new PR review
| -rw-r--r-- | library/alloc/src/boxed/thin.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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<T> ThinBox<T> { let ptr = WithOpaqueHeader::new(meta, value); ThinBox { ptr, _marker: PhantomData } } -} -#[unstable(feature = "thin_box", issue = "92791")] -impl<T> ThinBox<T> { /// 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 |
