rust/tests/ui/nll/issue-57280-1-flipped.rs
2023-01-11 09:32:08 +00:00

24 lines
432 B
Rust

// This test should compile, as the lifetimes
// in matches don't really matter.
//
// We currently use contravariance when checking the
// type of match arms.
trait Foo<'a> {
const C: &'a u32;
}
impl<'a, T> Foo<'a> for T {
const C: &'a u32 = &22;
}
fn foo<'a>(x: &'static u32) {
match x {
<() as Foo<'a>>::C => { }
//~^ ERROR lifetime may not live long enough
&_ => { }
}
}
fn main() {}