1 // Issue #14061: tests the interaction between generic implementation
2 // parameter bounds and trait objects.
6 struct S<T>(marker::PhantomData<T>);
9 fn get(&self) -> T { panic!() }
12 impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
15 let t: S<T> = S(marker::PhantomData);
16 let a = &t as &dyn Gettable<T>;
17 //~^ ERROR `T` cannot be sent between threads safely
18 //~| ERROR : Copy` is not satisfied
22 let t: S<T> = S(marker::PhantomData);
23 let a: &dyn Gettable<T> = &t;
24 //~^ ERROR `T` cannot be sent between threads safely
25 //~| ERROR : Copy` is not satisfied
29 let t: S<&'a isize> = S(marker::PhantomData);
30 let a = &t as &dyn Gettable<&'a isize>;
34 let t: Box<S<String>> = Box::new(S(marker::PhantomData));
35 let a = t as Box<dyn Gettable<String>>;
36 //~^ ERROR : Copy` is not satisfied
40 struct Foo; // does not impl Copy
42 let t: Box<S<Foo>> = Box::new(S(marker::PhantomData));
43 let a: Box<dyn Gettable<Foo>> = t;
44 //~^ ERROR : Copy` is not satisfied