2018-08-08 07:28:26 -05:00
|
|
|
error[E0500]: closure requires unique access to `x` but it is already borrowed
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-unique.rs:26:14
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let c1 = || get(x);
|
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let c2 = || set(x);
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| closure construction occurs here
|
2018-08-15 16:26:59 -05:00
|
|
|
LL | c1;
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | }
|
|
|
|
| - borrow ends here
|
|
|
|
|
|
|
|
error[E0500]: closure requires unique access to `x` but it is already borrowed
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-unique.rs:32:14
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let c1 = || get(x);
|
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let c2 = || { get(x); set(x); };
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| closure construction occurs here
|
2018-08-15 16:26:59 -05:00
|
|
|
LL | c1;
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | }
|
|
|
|
| - borrow ends here
|
|
|
|
|
|
|
|
error[E0524]: two closures require unique access to `x` at the same time
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-unique.rs:38:14
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let c1 = || set(x);
|
|
|
|
| -- - previous borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| first closure is constructed here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let c2 = || set(x);
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^ - borrow occurs due to use of `x` in closure
|
|
|
|
| |
|
|
|
|
| second closure is constructed here
|
2018-08-15 16:26:59 -05:00
|
|
|
LL | c1;
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | }
|
|
|
|
| - borrow from first closure ends here
|
|
|
|
|
|
|
|
error[E0595]: closure cannot assign to immutable argument `x`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-unique.rs:47:14
|
2018-08-15 16:26:59 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let c1 = |y: &'static mut isize| x = y;
|
2018-08-15 16:26:59 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
|
|
|
|
help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
|
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x
|
2018-08-15 16:26:59 -05:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error[E0595]: closure cannot assign to immutable argument `x`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/borrowck-closures-unique.rs:52:14
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let c1 = || x = panic!();
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^ cannot borrow mutably
|
|
|
|
help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
|
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | x
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^
|
|
|
|
|
2018-08-15 16:26:59 -05:00
|
|
|
error: aborting due to 5 previous errors
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
Some errors have detailed explanations: E0500, E0595.
|
2018-08-08 07:28:26 -05:00
|
|
|
For more information about an error, try `rustc --explain E0500`.
|