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