2018-10-03 22:40:21 -05:00
|
|
|
#![feature(unsize, dispatch_from_dyn)]
|
2018-09-20 02:28:57 -05:00
|
|
|
|
|
|
|
use std::{
|
2018-10-03 22:40:21 -05:00
|
|
|
ops::DispatchFromDyn,
|
2018-09-20 02:28:57 -05:00
|
|
|
marker::{Unsize, PhantomData},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct WrapperWithExtraField<T>(T, i32);
|
|
|
|
|
2018-10-03 22:40:21 -05:00
|
|
|
impl<T, U> DispatchFromDyn<WrapperWithExtraField<U>> for WrapperWithExtraField<T>
|
2018-09-20 02:28:57 -05:00
|
|
|
where
|
2018-10-03 22:40:21 -05:00
|
|
|
T: DispatchFromDyn<U>,
|
|
|
|
{} //~^^^ ERROR [E0378]
|
2018-09-20 02:28:57 -05:00
|
|
|
|
|
|
|
|
|
|
|
struct MultiplePointers<T: ?Sized>{
|
|
|
|
ptr1: *const T,
|
|
|
|
ptr2: *const T,
|
|
|
|
}
|
|
|
|
|
2018-10-03 22:40:21 -05:00
|
|
|
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<MultiplePointers<U>> for MultiplePointers<T>
|
2018-09-20 02:28:57 -05:00
|
|
|
where
|
|
|
|
T: Unsize<U>,
|
|
|
|
{} //~^^^ ERROR [E0378]
|
|
|
|
|
|
|
|
|
|
|
|
struct NothingToCoerce<T: ?Sized> {
|
|
|
|
data: PhantomData<T>,
|
|
|
|
}
|
|
|
|
|
2018-10-03 22:40:21 -05:00
|
|
|
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<NothingToCoerce<T>> for NothingToCoerce<U> {}
|
2018-09-20 02:28:57 -05:00
|
|
|
//~^ ERROR [E0378]
|
|
|
|
|
2018-10-26 00:09:33 -05:00
|
|
|
#[repr(C)]
|
|
|
|
struct HasReprC<T: ?Sized>(Box<T>);
|
|
|
|
|
|
|
|
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<HasReprC<U>> for HasReprC<T>
|
|
|
|
where
|
|
|
|
T: Unsize<U>,
|
|
|
|
{} //~^^^ ERROR [E0378]
|
|
|
|
|
2019-04-30 07:38:17 -05:00
|
|
|
#[repr(align(64))]
|
|
|
|
struct OverAlignedZst;
|
|
|
|
struct OverAligned<T: ?Sized>(Box<T>, OverAlignedZst);
|
|
|
|
|
|
|
|
impl<T: ?Sized, U: ?Sized> DispatchFromDyn<OverAligned<U>> for OverAligned<T>
|
|
|
|
where
|
|
|
|
T: Unsize<U>,
|
|
|
|
{} //~^^^ ERROR [E0378]
|
|
|
|
|
2018-09-20 02:28:57 -05:00
|
|
|
fn main() {}
|