1
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
2
- --> $DIR/borrowck-closures-two-mut.rs:14:24
3
- |
4
- LL | let c1 = to_fn_mut(|| x = 4);
5
- | -- - previous borrow occurs due to use of `x` in closure
6
- | |
7
- | first mutable borrow occurs here
8
- LL | let c2 = to_fn_mut(|| x = 5);
9
- | ^^ - borrow occurs due to use of `x` in closure
10
- | |
11
- | second mutable borrow occurs here
12
- ...
13
- LL | }
14
- | - first borrow ends here
15
-
16
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
17
- --> $DIR/borrowck-closures-two-mut.rs:26:24
18
- |
19
- LL | let c1 = to_fn_mut(|| set(&mut x));
20
- | -- - previous borrow occurs due to use of `x` in closure
21
- | |
22
- | first mutable borrow occurs here
23
- LL | let c2 = to_fn_mut(|| set(&mut x));
24
- | ^^ - borrow occurs due to use of `x` in closure
25
- | |
26
- | second mutable borrow occurs here
27
- ...
28
- LL | }
29
- | - first borrow ends here
30
-
31
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
32
- --> $DIR/borrowck-closures-two-mut.rs:34:24
33
- |
34
- LL | let c1 = to_fn_mut(|| x = 5);
35
- | -- - previous borrow occurs due to use of `x` in closure
36
- | |
37
- | first mutable borrow occurs here
38
- LL | let c2 = to_fn_mut(|| set(&mut x));
39
- | ^^ - borrow occurs due to use of `x` in closure
40
- | |
41
- | second mutable borrow occurs here
42
- ...
43
- LL | }
44
- | - first borrow ends here
45
-
46
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
47
- --> $DIR/borrowck-closures-two-mut.rs:42:24
48
- |
49
- LL | let c1 = to_fn_mut(|| x = 5);
50
- | -- - previous borrow occurs due to use of `x` in closure
51
- | |
52
- | first mutable borrow occurs here
53
- LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
54
- | ^^ - borrow occurs due to use of `x` in closure
55
- | |
56
- | second mutable borrow occurs here
57
- ...
58
- LL | }
59
- | - first borrow ends here
60
-
61
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast)
62
- --> $DIR/borrowck-closures-two-mut.rs:55:24
63
- |
64
- LL | let c1 = to_fn_mut(|| set(&mut *x.f));
65
- | -- - previous borrow occurs due to use of `x` in closure
66
- | |
67
- | first mutable borrow occurs here
68
- LL | let c2 = to_fn_mut(|| set(&mut *x.f));
69
- | ^^ - borrow occurs due to use of `x` in closure
70
- | |
71
- | second mutable borrow occurs here
72
- ...
73
- LL | }
74
- | - first borrow ends here
75
-
76
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
77
- --> $DIR/borrowck-closures-two-mut.rs:14:24
1
+ error[E0499]: cannot borrow `x` as mutable more than once at a time
2
+ --> $DIR/borrowck-closures-two-mut.rs:12:24
78
3
|
79
4
LL | let c1 = to_fn_mut(|| x = 4);
80
5
| -- - first borrow occurs due to use of `x` in closure
@@ -84,12 +9,11 @@ LL | let c2 = to_fn_mut(|| x = 5);
84
9
| ^^ - second borrow occurs due to use of `x` in closure
85
10
| |
86
11
| second mutable borrow occurs here
87
- LL |
88
12
LL | drop((c1, c2));
89
13
| -- first borrow later used here
90
14
91
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
92
- --> $DIR/borrowck-closures-two-mut.rs:26 :24
15
+ error[E0499]: cannot borrow `x` as mutable more than once at a time
16
+ --> $DIR/borrowck-closures-two-mut.rs:23 :24
93
17
|
94
18
LL | let c1 = to_fn_mut(|| set(&mut x));
95
19
| -- - first borrow occurs due to use of `x` in closure
@@ -99,12 +23,11 @@ LL | let c2 = to_fn_mut(|| set(&mut x));
99
23
| ^^ - second borrow occurs due to use of `x` in closure
100
24
| |
101
25
| second mutable borrow occurs here
102
- LL |
103
26
LL | drop((c1, c2));
104
27
| -- first borrow later used here
105
28
106
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
107
- --> $DIR/borrowck-closures-two-mut.rs:34 :24
29
+ error[E0499]: cannot borrow `x` as mutable more than once at a time
30
+ --> $DIR/borrowck-closures-two-mut.rs:30 :24
108
31
|
109
32
LL | let c1 = to_fn_mut(|| x = 5);
110
33
| -- - first borrow occurs due to use of `x` in closure
@@ -114,12 +37,11 @@ LL | let c2 = to_fn_mut(|| set(&mut x));
114
37
| ^^ - second borrow occurs due to use of `x` in closure
115
38
| |
116
39
| second mutable borrow occurs here
117
- LL |
118
40
LL | drop((c1, c2));
119
41
| -- first borrow later used here
120
42
121
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
122
- --> $DIR/borrowck-closures-two-mut.rs:42 :24
43
+ error[E0499]: cannot borrow `x` as mutable more than once at a time
44
+ --> $DIR/borrowck-closures-two-mut.rs:37 :24
123
45
|
124
46
LL | let c1 = to_fn_mut(|| x = 5);
125
47
| -- - first borrow occurs due to use of `x` in closure
@@ -129,12 +51,12 @@ LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes
129
51
| ^^ - second borrow occurs due to use of `x` in closure
130
52
| |
131
53
| second mutable borrow occurs here
132
- ...
54
+ LL |
133
55
LL | drop((c1, c2));
134
56
| -- first borrow later used here
135
57
136
- error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir)
137
- --> $DIR/borrowck-closures-two-mut.rs:55 :24
58
+ error[E0499]: cannot borrow `x` as mutable more than once at a time
59
+ --> $DIR/borrowck-closures-two-mut.rs:49 :24
138
60
|
139
61
LL | let c1 = to_fn_mut(|| set(&mut *x.f));
140
62
| -- - first borrow occurs due to use of `x` in closure
@@ -144,10 +66,10 @@ LL | let c2 = to_fn_mut(|| set(&mut *x.f));
144
66
| ^^ - second borrow occurs due to use of `x` in closure
145
67
| |
146
68
| second mutable borrow occurs here
147
- ...
69
+ LL |
148
70
LL | drop((c1, c2));
149
71
| -- first borrow later used here
150
72
151
- error: aborting due to 10 previous errors
73
+ error: aborting due to 5 previous errors
152
74
153
75
For more information about this error, try `rustc --explain E0499`.
0 commit comments