]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/cross/cross-borrow-trait.rs
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 type `&dyn Trait`
12 //~| found type `std::boxed::Box<dyn Trait>`