]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-58299.rs
Auto merge of #105121 - oli-obk:simpler-cheaper-dump_mir, r=nnethercote
[rust.git] / src / test / ui / nll / issue-58299.rs
1 struct A<'a>(&'a ());
2
3 trait Y {
4     const X: i32;
5 }
6
7 impl Y for A<'static> {
8     const X: i32 = 10;
9 }
10
11 fn foo<'a>(x: i32) {
12     match x {
13         // This uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`.
14         A::<'a>::X..=A::<'static>::X => (), //~ ERROR lifetime may not live long enough
15         _ => (),
16     }
17 }
18
19 fn bar<'a>(x: i32) {
20     match x {
21         // This uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`.
22         A::<'static>::X..=A::<'a>::X => (), //~ ERROR lifetime may not live long enough
23         _ => (),
24     }
25 }
26
27 fn main() {}