crlf0710 · GitHub

View all comments

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

Unresolved Questions

  • None yet.

Read the original on github.com ↗