1 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
2 --> $DIR/borrowck-closures-mut-and-imm.rs:21:14
4 LL | let c1 = || x = 4;
5 | -- - previous borrow occurs due to use of `x` in closure
7 | mutable borrow occurs here
8 LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
9 | ^^ - borrow occurs due to use of `x` in closure
11 | immutable borrow occurs here
14 | - mutable borrow ends here
16 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
17 --> $DIR/borrowck-closures-mut-and-imm.rs:29:14
19 LL | let c1 = || set(&mut x);
20 | -- - previous borrow occurs due to use of `x` in closure
22 | mutable borrow occurs here
23 LL | let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
24 | ^^ - borrow occurs due to use of `x` in closure
26 | immutable borrow occurs here
29 | - mutable borrow ends here
31 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
32 --> $DIR/borrowck-closures-mut-and-imm.rs:37:14
34 LL | let c1 = || set(&mut x);
35 | -- - previous borrow occurs due to use of `x` in closure
37 | mutable borrow occurs here
38 LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
39 | ^^ - borrow occurs due to use of `x` in closure
41 | immutable borrow occurs here
44 | - mutable borrow ends here
46 error[E0506]: cannot assign to `x` because it is borrowed
47 --> $DIR/borrowck-closures-mut-and-imm.rs:45:5
49 LL | let c2 = || x * 5;
50 | -- borrow of `x` occurs here
51 LL | x = 5; //[ast]~ ERROR cannot assign
52 | ^^^^^ assignment to borrowed `x` occurs here
54 error[E0506]: cannot assign to `x` because it is borrowed
55 --> $DIR/borrowck-closures-mut-and-imm.rs:53:5
57 LL | let c1 = || get(&x);
58 | -- borrow of `x` occurs here
59 LL | x = 5; //[ast]~ ERROR cannot assign
60 | ^^^^^ assignment to borrowed `x` occurs here
62 error[E0506]: cannot assign to `*x` because it is borrowed
63 --> $DIR/borrowck-closures-mut-and-imm.rs:61:5
65 LL | let c1 = || get(&*x);
66 | -- borrow of `*x` occurs here
67 LL | *x = 5; //[ast]~ ERROR cannot assign to `*x`
68 | ^^^^^^ assignment to borrowed `*x` occurs here
70 error[E0506]: cannot assign to `*x.f` because it is borrowed
71 --> $DIR/borrowck-closures-mut-and-imm.rs:73:5
73 LL | let c1 = || get(&*x.f);
74 | -- borrow of `*x.f` occurs here
75 LL | *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
76 | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
78 error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
79 --> $DIR/borrowck-closures-mut-and-imm.rs:85:14
81 LL | let c1 = || get(&*x.f);
82 | -- - previous borrow occurs due to use of `x` in closure
84 | immutable borrow occurs here
85 LL | let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
86 | ^^ - borrow occurs due to use of `x` in closure
88 | mutable borrow occurs here
91 | - immutable borrow ends here
93 error: aborting due to 8 previous errors
95 Some errors occurred: E0502, E0506.
96 For more information about an error, try `rustc --explain E0502`.