Closed
Description
This prevents Rc from having a sound definition with respect to dropcheck
#![feature(unsize, coerce_unsized)]
use std::marker::{Unsize, PhantomData};
use std::ops::CoerceUnsized;
struct MyRc<T: ?Sized> {
ptr: *const T,
_boo: PhantomData<T>,
}
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ }
fn main() {}
<anon>:11:1: 11:77 error: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, but 2 fields need coercions: ptr (*const T to *const U), _boo (core::marker::PhantomData<T> to core::marker::PhantomData<U>) [E0375]
<anon>:11 impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<MyRc<U>> for MyRc<T>{ }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error