]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-4335.stderr
Update tests for changes to cannot move errors
[rust.git] / src / test / ui / issues / issue-4335.stderr
1 error[E0507]: cannot move out of `*v`, as `v` is a captured variable in an `FnMut` closure
2   --> $DIR/issue-4335.rs:6:20
3    |
4 LL | fn f<'r, T>(v: &'r T) -> Box<dyn FnMut() -> T + 'r> {
5    |             - captured outer variable
6 LL |     id(Box::new(|| *v))
7    |                    ^^ move occurs because `*v` has type `T`, which does not implement the `Copy` trait
8
9 error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function
10   --> $DIR/issue-4335.rs:6:17
11    |
12 LL |     id(Box::new(|| *v))
13    |                 ^^  - `v` is borrowed here
14    |                 |
15    |                 may outlive borrowed value `v`
16    |
17 note: closure is returned here
18   --> $DIR/issue-4335.rs:6:5
19    |
20 LL |     id(Box::new(|| *v))
21    |     ^^^^^^^^^^^^^^^^^^^
22 help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword
23    |
24 LL |     id(Box::new(move || *v))
25    |                 ^^^^^^^
26
27 error: aborting due to 2 previous errors
28
29 Some errors have detailed explanations: E0373, E0507.
30 For more information about an error, try `rustc --explain E0373`.