-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.
Description
It's implemented for raw pointers, references, boxes, Rc, Arc, NonZero, and Shared. Is there a specific reason it can't be implemented for Unique?
As it stands, you can't actually reimplement something like Box the same way the standard library does. Somehow, even though a Box is just a wrapper around Unique, it can be coerced to an unsized type due to some compiler magic.
The following is paraphrased from the Box source, but does not compile:
use std::marker::Unsize;
use std::ops::CoerceUnsized;
use std::ptr::Unique;
pub struct MyBox<T: ?Sized>(Unique<T>);
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<MyBox<U>> for MyBox<T> {}
fn main() { }
Metadata
Metadata
Assignees
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the RFC.Relevant to the library API team, which will review and decide on the RFC.