blob: 6ac68f5adbce8e42224c687ccabc4d72bf728c40 (
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
28
|
//@ edition: 2024
// Regression test for #140583. We want to borrowck nested
// bodies even if they are in dead code. While not necessary for
// soundness, it is desirable to error in such cases.
fn main() {
return;
|x: &str| -> &'static str { x };
//~^ ERROR lifetime may not live long enough
|| {
|| {
let temp = 1;
let p: &'static u32 = &temp;
//~^ ERROR `temp` does not live long enough
};
};
const {
let temp = 1;
let p: &'static u32 = &temp;
//~^ ERROR `temp` does not live long enough
};
async {
let temp = 1;
let p: &'static u32 = &temp;
//~^ ERROR `temp` does not live long enough
};
}
|