Closed
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() { }