| error[E0500]: closure requires unique access to `x` but it is already borrowed |
| --> $DIR/borrowck-closures-unique.rs:36:14 |
| | |
| LL | let c1 = || get(x); |
| | -- - previous borrow occurs due to use of `x` in closure |
| | | |
| | borrow occurs here |
| LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x` |
| | ^^ - borrow occurs due to use of `x` in closure |
| | | |
| | closure construction occurs here |
| LL | c1; |
| LL | } |
| | - borrow ends here |
| |
| error[E0500]: closure requires unique access to `x` but it is already borrowed |
| --> $DIR/borrowck-closures-unique.rs:42:14 |
| | |
| LL | let c1 = || get(x); |
| | -- - previous borrow occurs due to use of `x` in closure |
| | | |
| | borrow occurs here |
| LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` |
| | ^^ - borrow occurs due to use of `x` in closure |
| | | |
| | closure construction occurs here |
| LL | c1; |
| LL | } |
| | - borrow ends here |
| |
| error[E0524]: two closures require unique access to `x` at the same time |
| --> $DIR/borrowck-closures-unique.rs:48:14 |
| | |
| LL | let c1 = || set(x); |
| | -- - previous borrow occurs due to use of `x` in closure |
| | | |
| | first closure is constructed here |
| LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time |
| | ^^ - borrow occurs due to use of `x` in closure |
| | | |
| | second closure is constructed here |
| LL | c1; |
| LL | } |
| | - borrow from first closure ends here |
| |
| error[E0595]: closure cannot assign to immutable argument `x` |
| --> $DIR/borrowck-closures-unique.rs:57:14 |
| | |
| LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument |
| | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably |
| help: consider removing the `&mut`, as it is an immutable binding to a mutable reference |
| | |
| LL | x //~ ERROR closure cannot assign to immutable argument |
| | ^ |
| |
| error[E0595]: closure cannot assign to immutable argument `x` |
| --> $DIR/borrowck-closures-unique.rs:62:14 |
| | |
| LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument |
| | ^^ cannot borrow mutably |
| help: consider removing the `&mut`, as it is an immutable binding to a mutable reference |
| | |
| LL | x //~ ERROR closure cannot assign to immutable argument |
| | ^ |
| |
| error: aborting due to 5 previous errors |
| |
| Some errors occurred: E0500, E0524, E0595. |
| For more information about an error, try `rustc --explain E0500`. |