]> git.proxmox.com Git - rustc.git/blame - src/test/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / const-generics / min_const_generics / forbid-non-static-lifetimes.rs
CommitLineData
1b1a35ee 1// This test checks that non-static lifetimes are prohibited under `min_const_generics`. It
94222f64 2// currently emits an error with `min_const_generics`.
1b1a35ee
XL
3
4fn test<const N: usize>() {}
5
6fn 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
12fn issue_75323_and_74447_2() {
13 test::<{ let _: &(); 3 },>();
14}
15
16fn issue_75323_and_74447_3() {
17 test::<{ let _: &'static (); 3 },>();
18}
19
20fn issue_73375<'a>() {
21 [(); (|_: &'a u8| (), 0).1];
22 //~^ ERROR a non-static lifetime is not allowed in a `const`
23}
24
25fn main() {}