summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/issue-57280-1-flipped.rs
blob: ad4b8dcfde4325e8f7c0cfb6eacf32cb628e9166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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() {}