1 // Test that cross-borrowing (implicitly converting from `Box<T>` to `&T`) is
2 // forbidden when `T` is a trait.
5 trait Trait { fn foo(&self) {} }
9 let x: Box<dyn Trait> = Box::new(Foo);
10 let _y: &dyn Trait = x; //~ ERROR E0308
11 //~| expected reference `&dyn Trait`
12 //~| found struct `Box<dyn Trait>`