rust/tests/ui/traits/trait-upcasting/upcast-through-struct-tail.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
310 B
Rust
Raw Normal View History

// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
struct Wrapper<T: ?Sized>(T);
trait A: B {}
trait B {}
fn test<'a>(x: Box<Wrapper<dyn A + 'a>>) -> Box<Wrapper<dyn B + 'a>> {
x
//~^ ERROR cannot cast `dyn A` to `dyn B`, trait upcasting coercion is experimental
}
fn main() {}