1 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
2 --> $DIR/closure-access-spans.rs:5:5
5 | ------ mutable borrow occurs here
7 | ^^ - second borrow occurs due to use of `x` in closure
9 | immutable borrow occurs here
11 | ----------- mutable borrow later used here
13 error[E0499]: cannot borrow `x` as mutable more than once at a time
14 --> $DIR/closure-access-spans.rs:11:5
17 | ------ first mutable borrow occurs here
19 | ^^ - second borrow occurs due to use of `x` in closure
21 | second mutable borrow occurs here
23 | ----------- first borrow later used here
25 error[E0500]: closure requires unique access to `x` but it is already borrowed
26 --> $DIR/closure-access-spans.rs:17:5
29 | ------ borrow occurs here
31 | ^^ -- second borrow occurs due to use of `x` in closure
33 | closure construction occurs here
35 | ----------- first borrow later used here
37 error[E0503]: cannot use `x` because it was mutably borrowed
38 --> $DIR/closure-access-spans.rs:23:13
41 | ------ `x` is borrowed here
43 | ^ use of borrowed `x`
45 | ----------- borrow later used here
47 error[E0505]: cannot move out of `x` because it is borrowed
48 --> $DIR/closure-access-spans.rs:29:5
50 LL | fn closure_move_capture_conflict(mut x: String) {
51 | ----- binding `x` declared here
53 | -- borrow of `x` occurs here
55 | ^^ - move occurs due to use in closure
57 | move out of `x` occurs here
59 | ----------- borrow later used here
61 error[E0382]: borrow of moved value: `x`
62 --> $DIR/closure-access-spans.rs:35:5
64 LL | fn closure_imm_capture_moved(mut x: String) {
65 | ----- move occurs because `x` has type `String`, which does not implement the `Copy` trait
69 | ^^ - borrow occurs due to use in closure
71 | value borrowed here after move
73 help: consider cloning the value if the performance cost is acceptable
75 LL | let r = x.clone();
78 error[E0382]: borrow of moved value: `x`
79 --> $DIR/closure-access-spans.rs:40:5
81 LL | fn closure_mut_capture_moved(mut x: String) {
82 | ----- move occurs because `x` has type `String`, which does not implement the `Copy` trait
85 LL | || x = String::new();
86 | ^^ - borrow occurs due to use in closure
88 | value borrowed here after move
90 help: consider cloning the value if the performance cost is acceptable
92 LL | let r = x.clone();
95 error[E0382]: borrow of moved value: `x`
96 --> $DIR/closure-access-spans.rs:45:5
98 LL | fn closure_unique_capture_moved(x: &mut String) {
99 | - move occurs because `x` has type `&mut String`, which does not implement the `Copy` trait
102 LL | || *x = String::new();
103 | ^^ -- borrow occurs due to use in closure
105 | value borrowed here after move
107 error[E0382]: use of moved value: `x`
108 --> $DIR/closure-access-spans.rs:50:5
110 LL | fn closure_move_capture_moved(x: &mut String) {
111 | - move occurs because `x` has type `&mut String`, which does not implement the `Copy` trait
115 | ^^ - use occurs due to use in closure
117 | value used here after move
119 error: aborting due to 9 previous errors
121 Some errors have detailed explanations: E0382, E0499, E0500, E0502, E0503, E0505.
122 For more information about an error, try `rustc --explain E0382`.