2017-11-11 03:15:26 -06:00
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:14:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| x = 4);
|
2017-11-11 03:15:26 -06:00
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
|
2017-11-11 03:15:26 -06:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2018-04-09 04:28:00 -05:00
|
|
|
...
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | }
|
2017-11-11 03:15:26 -06:00
|
|
|
| - first borrow ends here
|
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:26:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| set(&mut x));
|
2017-11-11 03:15:26 -06:00
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
2017-11-11 03:15:26 -06:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2018-04-09 04:28:00 -05:00
|
|
|
...
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | }
|
2017-11-11 03:15:26 -06:00
|
|
|
| - first borrow ends here
|
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:34:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| x = 5);
|
2017-11-11 03:15:26 -06:00
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
2017-11-11 03:15:26 -06:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2018-04-09 04:28:00 -05:00
|
|
|
...
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | }
|
2017-11-11 03:15:26 -06:00
|
|
|
| - first borrow ends here
|
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| x = 5);
|
2017-11-11 03:15:26 -06:00
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
2017-11-11 03:15:26 -06:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2017-11-20 06:13:27 -06:00
|
|
|
...
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | }
|
2017-11-11 03:15:26 -06:00
|
|
|
| - first borrow ends here
|
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:55:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
|
2017-11-11 03:15:26 -06:00
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| set(&mut *x.f));
|
2017-11-11 03:15:26 -06:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2017-11-20 06:13:27 -06:00
|
|
|
...
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | }
|
2017-11-11 03:15:26 -06:00
|
|
|
| - first borrow ends here
|
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:14:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| x = 4);
|
2018-08-01 15:02:10 -05:00
|
|
|
| -- - first borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
|
2018-08-01 15:02:10 -05:00
|
|
|
| ^^ - second borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2018-02-24 17:01:39 -06:00
|
|
|
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
2018-04-09 04:28:00 -05:00
|
|
|
LL | drop((c1, c2));
|
2018-09-29 05:47:47 -05:00
|
|
|
| -- first borrow later used here
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:26:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| set(&mut x));
|
2018-08-01 15:02:10 -05:00
|
|
|
| -- - first borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
2018-08-01 15:02:10 -05:00
|
|
|
| ^^ - second borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2018-02-24 17:01:39 -06:00
|
|
|
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
2018-04-09 04:28:00 -05:00
|
|
|
LL | drop((c1, c2));
|
2018-09-29 05:47:47 -05:00
|
|
|
| -- first borrow later used here
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:34:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| x = 5);
|
2018-08-01 15:02:10 -05:00
|
|
|
| -- - first borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
|
2018-08-01 15:02:10 -05:00
|
|
|
| ^^ - second borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2018-02-24 17:01:39 -06:00
|
|
|
LL | //~| ERROR cannot borrow `x` as mutable more than once
|
2018-04-09 04:28:00 -05:00
|
|
|
LL | drop((c1, c2));
|
2018-09-29 05:47:47 -05:00
|
|
|
| -- first borrow later used here
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:42:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| x = 5);
|
2018-08-01 15:02:10 -05:00
|
|
|
| -- - first borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
|
2018-08-01 15:02:10 -05:00
|
|
|
| ^^ - second borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2017-11-20 06:13:27 -06:00
|
|
|
...
|
2018-04-09 04:28:00 -05:00
|
|
|
LL | drop((c1, c2));
|
2018-09-29 05:47:47 -05:00
|
|
|
| -- first borrow later used here
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-two-mut.rs:55:24
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
|
2018-08-01 15:02:10 -05:00
|
|
|
| -- - first borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let c2 = to_fn_mut(|| set(&mut *x.f));
|
2018-08-01 15:02:10 -05:00
|
|
|
| ^^ - second borrow occurs due to use of `x` in closure
|
2017-11-11 03:15:26 -06:00
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2017-11-20 06:13:27 -06:00
|
|
|
...
|
2018-04-09 04:28:00 -05:00
|
|
|
LL | drop((c1, c2));
|
2018-09-29 05:47:47 -05:00
|
|
|
| -- first borrow later used here
|
2017-11-11 03:15:26 -06:00
|
|
|
|
|
|
|
error: aborting due to 10 previous errors
|
|
|
|
|
2018-03-03 08:59:40 -06:00
|
|
|
For more information about this error, try `rustc --explain E0499`.
|