blob: beb853fc91ae504c96115018b02595406c2ee959 [file] [log] [blame]
error[E0507]: cannot move out of captured variable in an `FnMut` closure
--> $DIR/issue-4335.rs:16:20
|
LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
| - captured outer variable
LL | id(Box::new(|| *v))
| ^^ cannot move out of captured variable in an `FnMut` closure
error[E0507]: cannot move out of `*v` which is behind a `&` reference
--> $DIR/issue-4335.rs:16:20
|
LL | id(Box::new(|| *v))
| ^^
| |
| cannot move out of `*v` which is behind a `&` reference
| cannot move
error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function
--> $DIR/issue-4335.rs:16:17
|
LL | id(Box::new(|| *v))
| ^^ - `v` is borrowed here
| |
| may outlive borrowed value `v`
|
note: closure is returned here
--> $DIR/issue-4335.rs:16:5
|
LL | id(Box::new(|| *v))
| ^^^^^^^^^^^^^^^^^^^
help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword
|
LL | id(Box::new(move || *v))
| ^^^^^^^
error: aborting due to 3 previous errors
Some errors occurred: E0373, E0507.
For more information about an error, try `rustc --explain E0373`.