1 error[E0505]: cannot move out of `x` because it is borrowed
2 --> $DIR/closure-borrow-spans.rs:5:13
4 LL | let f = || x.len();
5 | -- - borrow occurs due to use in closure
7 | borrow of `x` occurs here
9 | ^ move out of `x` occurs here
11 | ----------- borrow later used here
13 error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
14 --> $DIR/closure-borrow-spans.rs:11:13
17 | -- - first borrow occurs due to use of `x` in closure
19 | immutable borrow occurs here
21 | ^^^^^^ mutable borrow occurs here
23 | ----------- immutable borrow later used here
25 error[E0597]: `x` does not live long enough
26 --> $DIR/closure-borrow-spans.rs:19:16
29 | -- ^ borrowed value does not live long enough
33 | - `x` dropped here while still borrowed
35 | ----------- borrow later used here
37 error[E0506]: cannot assign to `x` because it is borrowed
38 --> $DIR/closure-borrow-spans.rs:26:5
41 | -- - borrow occurs due to use in closure
43 | borrow of `x` occurs here
45 | ^^^^^ assignment to borrowed `x` occurs here
47 | ----------- borrow later used here
49 error[E0503]: cannot use `x` because it was mutably borrowed
50 --> $DIR/closure-borrow-spans.rs:32:13
52 LL | let f = || x = 0;
53 | -- - borrow occurs due to use of `x` in closure
55 | borrow of `x` occurs here
57 | ^ use of borrowed `x`
59 | ----------- borrow later used here
61 error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
62 --> $DIR/closure-borrow-spans.rs:38:13
64 LL | let f = || x = 0;
65 | -- - first borrow occurs due to use of `x` in closure
67 | mutable borrow occurs here
69 | ^^ immutable borrow occurs here
71 | ----------- mutable borrow later used here
73 error[E0499]: cannot borrow `x` as mutable more than once at a time
74 --> $DIR/closure-borrow-spans.rs:44:13
76 LL | let f = || x = 0;
77 | -- - first borrow occurs due to use of `x` in closure
79 | first mutable borrow occurs here
81 | ^^^^^^ second mutable borrow occurs here
83 | ----------- first borrow later used here
85 error[E0597]: `x` does not live long enough
86 --> $DIR/closure-borrow-spans.rs:52:16
89 | -- ^ borrowed value does not live long enough
93 | - `x` dropped here while still borrowed
95 | ----------- borrow later used here
97 error[E0506]: cannot assign to `x` because it is borrowed
98 --> $DIR/closure-borrow-spans.rs:59:5
100 LL | let f = || x = 0;
101 | -- - borrow occurs due to use in closure
103 | borrow of `x` occurs here
105 | ^^^^^ assignment to borrowed `x` occurs here
107 | ----------- borrow later used here
109 error[E0505]: cannot move out of `x` because it is borrowed
110 --> $DIR/closure-borrow-spans.rs:65:13
112 LL | let f = || *x = 0;
113 | -- -- borrow occurs due to use in closure
115 | borrow of `x` occurs here
117 | ^ move out of `x` occurs here
119 | ----------- borrow later used here
121 error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access
122 --> $DIR/closure-borrow-spans.rs:71:13
124 LL | let f = || *x = 0;
125 | -- -- first borrow occurs due to use of `x` in closure
127 | closure construction occurs here
129 | ^^ second borrow occurs here
131 | ----------- first borrow later used here
133 error[E0501]: cannot borrow `x` as mutable because previous closure requires unique access
134 --> $DIR/closure-borrow-spans.rs:77:13
136 LL | let f = || *x = 0;
137 | -- -- first borrow occurs due to use of `x` in closure
139 | closure construction occurs here
141 | ^^^^^^ second borrow occurs here
143 | ----------- first borrow later used here
145 error[E0597]: `x` does not live long enough
146 --> $DIR/closure-borrow-spans.rs:86:16
149 | -- ^^ borrowed value does not live long enough
151 | value captured here
153 | - `x` dropped here while still borrowed
155 | ----------- borrow later used here
157 error[E0506]: cannot assign to `*x` because it is borrowed
158 --> $DIR/closure-borrow-spans.rs:93:5
160 LL | let f = || *x = 0;
161 | -- -- borrow occurs due to use in closure
163 | borrow of `*x` occurs here
165 | ^^^^^^ assignment to borrowed `*x` occurs here
167 | ----------- borrow later used here
169 error: aborting due to 14 previous errors
171 Some errors have detailed explanations: E0499, E0501, E0502, E0503, E0505, E0506, E0597.
172 For more information about an error, try `rustc --explain E0499`.