]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / closures / closure-bounds-static-cant-capture-borrowed.nll.stderr
1 error[E0621]: explicit lifetime required in the type of `x`
2   --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:15:5
3    |
4 LL |   fn foo(x: &()) {
5    |             --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
6 LL | /     bar(|| {
7 LL | |         //~^ ERROR explicit lifetime required in the type of `x` [E0621]
8 LL | |         let _ = x;
9 LL | |     })
10    | |______^ lifetime `'static` required
11
12 error[E0597]: `x` does not live long enough
13   --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:17:17
14    |
15 LL |     bar(|| {
16    |         -- value captured here
17 LL |         //~^ ERROR explicit lifetime required in the type of `x` [E0621]
18 LL |         let _ = x;
19    |                 ^ borrowed value does not live long enough
20 LL |     })
21 LL | }
22    | - `x` dropped here while still borrowed
23    |
24    = note: borrowed value must be valid for the static lifetime...
25
26 error: aborting due to 2 previous errors
27
28 Some errors occurred: E0597, E0621.
29 For more information about an error, try `rustc --explain E0597`.