summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/issue-58299.rs
blob: 0587fe8b43b060e6b8752ce5b8721316e9b4e2ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
struct A<'a>(&'a ());

trait Y {
    const X: i32;
}

impl Y for A<'static> {
    const X: i32 = 10;
}

fn foo<'a>(x: i32) {
    match x {
        // This uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`.
        A::<'a>::X..=A::<'static>::X => (), //~ ERROR lifetime may not live long enough
        _ => (),
    }
}

fn bar<'a>(x: i32) {
    match x {
        // This uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`.
        A::<'static>::X..=A::<'a>::X => (), //~ ERROR lifetime may not live long enough
        _ => (),
    }
}

fn main() {}