Label definition of captured variables in errors.
This commit is contained in:
parent
51b0552bd7
commit
2c6b0e5cf7
9 changed files with 95 additions and 63 deletions
|
|
@ -1,6 +1,8 @@
|
|||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/borrowck-in-static.rs:15:17
|
||||
|
|
||||
LL | let x = Box::new(0);
|
||||
| - captured outer variable
|
||||
LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
|
||||
| ^ cannot move out of captured variable in an `Fn` closure
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9
|
||||
|
|
||||
LL | let y = vec![format!("World")];
|
||||
| - captured outer variable
|
||||
LL | call(|| {
|
||||
LL | y.into_iter();
|
||||
| ^ cannot move out of captured variable in an `Fn` closure
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ LL | f.f.call_mut(())
|
|||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13
|
||||
|
|
||||
LL | let mut f = move |g: Box<FnMut(isize)>, b: isize| {
|
||||
| ----- captured outer variable
|
||||
...
|
||||
LL | foo(f);
|
||||
| ^ cannot move out of captured variable in an `FnMut` closure
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue