2 #![feature(specialization)]
3 #![feature(unsize, coerce_unsized)]
4 #![allow(incomplete_features)]
6 use std::ops::CoerceUnsized;
8 pub struct SmartassPtr<A: Smartass+?Sized>(A::Data);
12 type Data2: CoerceUnsized<*const [u8]>;
15 pub trait MaybeObjectSafe {}
17 impl MaybeObjectSafe for () {}
19 impl<T> Smartass for T {
20 type Data = <Self as Smartass>::Data2;
21 default type Data2 = ();
22 //~^ ERROR: the trait bound `(): CoerceUnsized<*const [u8]>` is not satisfied
25 impl Smartass for () {
26 type Data2 = *const [u8; 1];
29 impl Smartass for dyn MaybeObjectSafe {
30 type Data = *const [u8];
31 type Data2 = *const [u8; 0];
34 impl<U: Smartass+?Sized, T: Smartass+?Sized> CoerceUnsized<SmartassPtr<T>> for SmartassPtr<U>
35 where <U as Smartass>::Data: std::ops::CoerceUnsized<<T as Smartass>::Data>
38 pub fn conv(s: SmartassPtr<()>) -> SmartassPtr<dyn MaybeObjectSafe> {