Label definition of captured variables in errors.

This commit is contained in:
David Wood 2018-08-07 17:06:21 +02:00
parent 51b0552bd7
commit 2c6b0e5cf7
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
9 changed files with 95 additions and 63 deletions

View file

@ -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

View file

@ -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

View file

@ -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