rust/tests/ui/borrowck/borrowck-closures-two-mut.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 lines
3.3 KiB
Plaintext
Raw Normal View History

2019-05-02 22:34:15 +00:00
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:12:24
|
2018-02-23 00:42:32 +00:00
LL | let c1 = to_fn_mut(|| x = 4);
| -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let c2 = to_fn_mut(|| x = 5);
| ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
LL | drop((c1, c2));
| -- first borrow later used here
2019-05-02 22:34:15 +00:00
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:23:24
|
2018-02-23 00:42:32 +00:00
LL | let c1 = to_fn_mut(|| set(&mut x));
| -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let c2 = to_fn_mut(|| set(&mut x));
| ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
LL | drop((c1, c2));
| -- first borrow later used here
2019-05-02 22:34:15 +00:00
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:30:24
|
2018-02-23 00:42:32 +00:00
LL | let c1 = to_fn_mut(|| x = 5);
| -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let c2 = to_fn_mut(|| set(&mut x));
| ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
LL | drop((c1, c2));
| -- first borrow later used here
2019-05-02 22:34:15 +00:00
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:37:24
|
2018-02-23 00:42:32 +00:00
LL | let c1 = to_fn_mut(|| x = 5);
| -- - first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
2018-02-23 00:42:32 +00:00
LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
| ^^ - second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
2019-05-02 22:34:15 +00:00
LL |
LL | drop((c1, c2));
| -- first borrow later used here
2019-05-02 22:34:15 +00:00
error[E0499]: cannot borrow `x` as mutable more than once at a time
--> $DIR/borrowck-closures-two-mut.rs:49:24
|
2018-02-23 00:42:32 +00:00
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
| -- ---- first borrow occurs due to use of `x` in closure
| |
| first mutable borrow occurs here
2018-02-23 00:42:32 +00:00
LL | let c2 = to_fn_mut(|| set(&mut *x.f));
| ^^ ---- second borrow occurs due to use of `x` in closure
| |
| second mutable borrow occurs here
2019-05-02 22:34:15 +00:00
LL |
LL | drop((c1, c2));
| -- first borrow later used here
2019-05-02 22:34:15 +00:00
error: aborting due to 5 previous errors
2018-03-03 14:59:40 +00:00
For more information about this error, try `rustc --explain E0499`.