1 error[E0500]: closure requires unique access to `x` but it is already borrowed
2 --> $DIR/borrowck-closures-unique.rs:34:14
4 LL | let c1 = || get(x);
5 | -- - previous borrow occurs due to use of `x` in closure
8 LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x`
9 | ^^ - borrow occurs due to use of `x` in closure
11 | closure construction occurs here
15 error[E0500]: closure requires unique access to `x` but it is already borrowed
16 --> $DIR/borrowck-closures-unique.rs:39:14
18 LL | let c1 = || get(x);
19 | -- - previous borrow occurs due to use of `x` in closure
22 LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
23 | ^^ - borrow occurs due to use of `x` in closure
25 | closure construction occurs here
29 error[E0524]: two closures require unique access to `x` at the same time
30 --> $DIR/borrowck-closures-unique.rs:44:14
32 LL | let c1 = || set(x);
33 | -- - previous borrow occurs due to use of `x` in closure
35 | first closure is constructed here
36 LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time
37 | ^^ - borrow occurs due to use of `x` in closure
39 | second closure is constructed here
41 | - borrow from first closure ends here
43 error[E0595]: closure cannot assign to immutable argument `x`
44 --> $DIR/borrowck-closures-unique.rs:48:14
46 LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument
47 | ^^ cannot borrow mutably
48 help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
50 LL | x //~ ERROR closure cannot assign to immutable argument
53 error: aborting due to 4 previous errors
55 Some errors occurred: E0500, E0524, E0595.
56 For more information about an error, try `rustc --explain E0500`.