1 /// The compiler previously did not properly check the bound of `From` when it was used from type
2 /// of the dyn trait object (use in `copy_any` below). Since the associated type is under user
3 /// control in this usage, the compiler could be tricked to believe any type implemented any trait.
4 /// This would ICE, except for pure marker traits like `Copy`. It did not require providing an
5 /// instance of the dyn trait type, only name said type.
6 trait Setup {
7     type From: Copy;
8 }
9 
copy<U: Setup + ?Sized>(from: &U::From) -> U::From10 fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
11     *from
12 }
13 
copy_any<T>(t: &T) -> T14 pub fn copy_any<T>(t: &T) -> T {
15     copy::<dyn Setup<From=T>>(t)
16     //~^ ERROR the trait bound `T: Copy` is not satisfied
17 }
18 
main()19 fn main() {}
20