1 // This test checks that non-static lifetimes are prohibited under `min_const_generics`. It
2 // currently emits an error with `min_const_generics`.
3
test<const N: usize>()4 fn test<const N: usize>() {}
5
issue_75323_and_74447_1<'a>() -> &'a ()6 fn issue_75323_and_74447_1<'a>() -> &'a () {
7 test::<{ let _: &'a (); 3 },>();
8 //~^ ERROR a non-static lifetime is not allowed in a `const`
9 &()
10 }
11
issue_75323_and_74447_2()12 fn issue_75323_and_74447_2() {
13 test::<{ let _: &(); 3 },>();
14 }
15
issue_75323_and_74447_3()16 fn issue_75323_and_74447_3() {
17 test::<{ let _: &'static (); 3 },>();
18 }
19
issue_73375<'a>()20 fn issue_73375<'a>() {
21 [(); (|_: &'a u8| (), 0).1];
22 //~^ ERROR a non-static lifetime is not allowed in a `const`
23 }
24
main()25 fn main() {}
26