]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-4335.nll.stderr
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-4335.nll.stderr
1 error[E0507]: cannot move out of captured variable in an `FnMut` closure
2   --> $DIR/issue-4335.rs:16:20
3    |
4 LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
5    |             - captured outer variable
6 LL |     id(Box::new(|| *v))
7    |                    ^^ cannot move out of captured variable in an `FnMut` closure
8
9 error[E0597]: `v` does not live long enough
10   --> $DIR/issue-4335.rs:16:21
11    |
12 LL |     id(Box::new(|| *v))
13    |                 --  ^ borrowed value does not live long enough
14    |                 |
15    |                 value captured here
16 ...
17 LL | }
18    | - `v` dropped here while still borrowed
19    |
20 note: borrowed value must be valid for the lifetime 'r as defined on the function body at 15:6...
21   --> $DIR/issue-4335.rs:15:6
22    |
23 LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
24    |      ^^
25
26 error: aborting due to 2 previous errors
27
28 Some errors occurred: E0507, E0597.
29 For more information about an error, try `rustc --explain E0507`.