]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-57280-1-flipped.rs
Rollup merge of #105216 - GuillaumeGomez:rm-unused-gui-test, r=notriddle
[rust.git] / src / test / ui / nll / issue-57280-1-flipped.rs
1 // This test should compile, as the lifetimes
2 // in matches don't really matter.
3 //
4 // We currently use contravariance when checking the
5 // type of match arms.
6
7 trait Foo<'a> {
8     const C: &'a u32;
9 }
10
11 impl<'a, T> Foo<'a> for T {
12     const C: &'a u32 = &22;
13 }
14
15 fn foo<'a>(x: &'static u32) {
16     match x {
17         <() as Foo<'a>>::C => { }
18         //~^ ERROR lifetime may not live long enough
19         &_ => { }
20     }
21 }
22
23 fn main() {}