Feature gate: #![feature(box_into_inner)]
This is a tracking issue for consuming a Box and returning its wrapped value.
The language actually supports *x as a special case. However it can't be generalized to other types easily. It also doesn't consume the Box value immediately if T is Copy, which is quite a footgun.
An explicit version is added here to make the API more consistent with Pin, Cell, RefCell etc.
Public API
impl<T, A: Allocator> Box<T, A> { pub fn into_inner(boxed: Self) -> T; }
Steps / History
- Implementation: Add
Box::into_inner. #80438 - Improve documentation for
Box::into_inner#98523 - Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
- None yet.