rust/tests/ui/nll/relate_tys/trait-hrtb.rs
2024-02-16 20:02:50 +00:00

15 lines
317 B
Rust

// Test that NLL generates proper error spans for trait HRTB errors
//
//@ compile-flags:-Zno-leak-check
trait Foo<'a> {}
fn make_foo<'a>() -> Box<dyn Foo<'a>> {
panic!()
}
fn main() {
let x: Box<dyn Foo<'static>> = make_foo();
let y: Box<dyn for<'a> Foo<'a>> = x; //~ ERROR mismatched types [E0308]
}