1 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
2 --> $DIR/borrowck-closures-mut-and-imm.rs:17:14
4 LL | let c1 = || x = 4;
5 | -- - first borrow occurs due to use of `x` in closure
7 | mutable borrow occurs here
8 LL | let c2 = || x * 5;
9 | ^^ - second borrow occurs due to use of `x` in closure
11 | immutable borrow occurs here
14 | -- mutable borrow later used here
16 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
17 --> $DIR/borrowck-closures-mut-and-imm.rs:25:14
19 LL | let c1 = || set(&mut x);
20 | -- - first borrow occurs due to use of `x` in closure
22 | mutable borrow occurs here
23 LL | let c2 = || get(&x);
24 | ^^ - second borrow occurs due to use of `x` in closure
26 | immutable borrow occurs here
29 | -- mutable borrow later used here
31 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
32 --> $DIR/borrowck-closures-mut-and-imm.rs:33:14
34 LL | let c1 = || set(&mut x);
35 | -- - first borrow occurs due to use of `x` in closure
37 | mutable borrow occurs here
38 LL | let c2 = || x * 5;
39 | ^^ - second borrow occurs due to use of `x` in closure
41 | immutable borrow occurs here
44 | -- mutable borrow later used here
46 error[E0506]: cannot assign to `x` because it is borrowed
47 --> $DIR/borrowck-closures-mut-and-imm.rs:41:5
49 LL | let c2 = || x * 5;
50 | -- - borrow occurs due to use in closure
52 | borrow of `x` occurs here
54 | ^^^^^ assignment to borrowed `x` occurs here
57 | -- borrow later used here
59 error[E0506]: cannot assign to `x` because it is borrowed
60 --> $DIR/borrowck-closures-mut-and-imm.rs:49:5
62 LL | let c1 = || get(&x);
63 | -- - borrow occurs due to use in closure
65 | borrow of `x` occurs here
67 | ^^^^^ assignment to borrowed `x` occurs here
70 | -- borrow later used here
72 error[E0506]: cannot assign to `*x` because it is borrowed
73 --> $DIR/borrowck-closures-mut-and-imm.rs:57:5
75 LL | let c1 = || get(&*x);
76 | -- -- borrow occurs due to use in closure
78 | borrow of `*x` occurs here
80 | ^^^^^^ assignment to borrowed `*x` occurs here
83 | -- borrow later used here
85 error[E0506]: cannot assign to `*x.f` because it is borrowed
86 --> $DIR/borrowck-closures-mut-and-imm.rs:69:5
88 LL | let c1 = || get(&*x.f);
89 | -- ---- borrow occurs due to use in closure
91 | borrow of `*x.f` occurs here
93 | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
96 | -- borrow later used here
98 error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
99 --> $DIR/borrowck-closures-mut-and-imm.rs:81:14
101 LL | let c1 = || get(&*x.f);
102 | -- ---- first borrow occurs due to use of `x` in closure
104 | immutable borrow occurs here
105 LL | let c2 = || *x.f = 5;
106 | ^^ ---- second borrow occurs due to use of `x` in closure
108 | mutable borrow occurs here
111 | -- immutable borrow later used here
113 error: aborting due to 8 previous errors
115 Some errors have detailed explanations: E0502, E0506.
116 For more information about an error, try `rustc --explain E0502`.