1 error[E0499]: cannot borrow `x` as mutable more than once at a time
2 --> $DIR/borrowck-closures-two-mut-fail.rs:26:24
4 LL | let c1 = to_fn_mut(|| x = 4);
5 | -- - first borrow occurs due to use of `x` in closure
7 | first mutable borrow occurs here
8 LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
9 | ^^ - second borrow occurs due to use of `x` in closure
11 | second mutable borrow occurs here
13 | -- borrow later used here
15 error[E0499]: cannot borrow `x` as mutable more than once at a time
16 --> $DIR/borrowck-closures-two-mut-fail.rs:37:24
18 LL | let c1 = to_fn_mut(|| set(&mut x));
19 | -- - first borrow occurs due to use of `x` in closure
21 | first mutable borrow occurs here
22 LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
23 | ^^ - second borrow occurs due to use of `x` in closure
25 | second mutable borrow occurs here
27 | -- borrow later used here
29 error[E0499]: cannot borrow `x` as mutable more than once at a time
30 --> $DIR/borrowck-closures-two-mut-fail.rs:44:24
32 LL | let c1 = to_fn_mut(|| x = 5);
33 | -- - first borrow occurs due to use of `x` in closure
35 | first mutable borrow occurs here
36 LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
37 | ^^ - second borrow occurs due to use of `x` in closure
39 | second mutable borrow occurs here
41 | -- borrow later used here
43 error[E0499]: cannot borrow `x` as mutable more than once at a time
44 --> $DIR/borrowck-closures-two-mut-fail.rs:51:24
46 LL | let c1 = to_fn_mut(|| x = 5);
47 | -- - first borrow occurs due to use of `x` in closure
49 | first mutable borrow occurs here
50 LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
51 | ^^ - second borrow occurs due to use of `x` in closure
53 | second mutable borrow occurs here
54 LL | //~^ ERROR cannot borrow `x` as mutable more than once
56 | -- borrow later used here
58 error[E0499]: cannot borrow `x` as mutable more than once at a time
59 --> $DIR/borrowck-closures-two-mut-fail.rs:63:24
61 LL | let c1 = to_fn_mut(|| set(&mut *x.f));
62 | -- - first borrow occurs due to use of `x` in closure
64 | first mutable borrow occurs here
65 LL | let c2 = to_fn_mut(|| set(&mut *x.f));
66 | ^^ - second borrow occurs due to use of `x` in closure
68 | second mutable borrow occurs here
69 LL | //~^ ERROR cannot borrow `x` as mutable more than once
71 | -- borrow later used here
73 error: aborting due to 5 previous errors
75 For more information about this error, try `rustc --explain E0499`.