|
| 1 | +error: lifetime may not live long enough |
| 2 | + --> $DIR/nested-bodies-in-dead-code.rs:9:33 |
| 3 | + | |
| 4 | +LL | |x: &str| -> &'static str { x }; |
| 5 | + | - ^ returning this value requires that `'1` must outlive `'static` |
| 6 | + | | |
| 7 | + | let's call the lifetime of this reference `'1` |
| 8 | + |
| 9 | +error[E0597]: `temp` does not live long enough |
| 10 | + --> $DIR/nested-bodies-in-dead-code.rs:14:35 |
| 11 | + | |
| 12 | +LL | let temp = 1; |
| 13 | + | ---- binding `temp` declared here |
| 14 | +LL | let p: &'static u32 = &temp; |
| 15 | + | ------------ ^^^^^ borrowed value does not live long enough |
| 16 | + | | |
| 17 | + | type annotation requires that `temp` is borrowed for `'static` |
| 18 | +LL | |
| 19 | +LL | }; |
| 20 | + | - `temp` dropped here while still borrowed |
| 21 | + |
| 22 | +error[E0597]: `temp` does not live long enough |
| 23 | + --> $DIR/nested-bodies-in-dead-code.rs:20:31 |
| 24 | + | |
| 25 | +LL | let temp = 1; |
| 26 | + | ---- binding `temp` declared here |
| 27 | +LL | let p: &'static u32 = &temp; |
| 28 | + | ------------ ^^^^^ borrowed value does not live long enough |
| 29 | + | | |
| 30 | + | type annotation requires that `temp` is borrowed for `'static` |
| 31 | +LL | |
| 32 | +LL | }; |
| 33 | + | - `temp` dropped here while still borrowed |
| 34 | + |
| 35 | +error[E0597]: `temp` does not live long enough |
| 36 | + --> $DIR/nested-bodies-in-dead-code.rs:25:31 |
| 37 | + | |
| 38 | +LL | let temp = 1; |
| 39 | + | ---- binding `temp` declared here |
| 40 | +LL | let p: &'static u32 = &temp; |
| 41 | + | ------------ ^^^^^ borrowed value does not live long enough |
| 42 | + | | |
| 43 | + | type annotation requires that `temp` is borrowed for `'static` |
| 44 | +LL | |
| 45 | +LL | }; |
| 46 | + | - `temp` dropped here while still borrowed |
| 47 | + |
| 48 | +error: aborting due to 4 previous errors |
| 49 | + |
| 50 | +For more information about this error, try `rustc --explain E0597`. |
0 commit comments