@@ -72,7 +72,7 @@ fn main() {
72
72
{
73
73
let mut e = Baz :: X ( 2 ) ;
74
74
let _e0 = e. x ( ) ;
75
- match e {
75
+ match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
76
76
Baz :: X ( value) => value
77
77
//[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
78
78
//[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
@@ -110,7 +110,7 @@ fn main() {
110
110
{
111
111
let mut e = Box :: new ( Baz :: X ( 3 ) ) ;
112
112
let _e0 = e. x ( ) ;
113
- match * e {
113
+ match * e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
114
114
Baz :: X ( value) => value
115
115
//[ast]~^ ERROR cannot use `e.0` because it was mutably borrowed
116
116
//[mir]~^^ ERROR cannot use `e.0` because it was mutably borrowed
@@ -127,25 +127,25 @@ fn main() {
127
127
{
128
128
let mut v = & [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ;
129
129
let _v = & mut v;
130
- match v {
130
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
131
131
& [ x, _, .., _, _] => println ! ( "{}" , x) ,
132
132
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
133
133
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
134
134
_ => panic ! ( "other case" ) ,
135
135
}
136
- match v {
136
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
137
137
& [ _, x, .., _, _] => println ! ( "{}" , x) ,
138
138
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
139
139
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
140
140
_ => panic ! ( "other case" ) ,
141
141
}
142
- match v {
142
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
143
143
& [ _, _, .., x, _] => println ! ( "{}" , x) ,
144
144
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
145
145
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
146
146
_ => panic ! ( "other case" ) ,
147
147
}
148
- match v {
148
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
149
149
& [ _, _, .., _, x] => println ! ( "{}" , x) ,
150
150
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
151
151
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
@@ -156,25 +156,25 @@ fn main() {
156
156
{
157
157
let mut v = & [ 1 , 2 , 3 , 4 , 5 ] ;
158
158
let _v = & mut v;
159
- match v {
159
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
160
160
& [ x..] => println ! ( "{:?}" , x) ,
161
161
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
162
162
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
163
163
_ => panic ! ( "other case" ) ,
164
164
}
165
- match v {
165
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
166
166
& [ _, x..] => println ! ( "{:?}" , x) ,
167
167
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
168
168
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
169
169
_ => panic ! ( "other case" ) ,
170
170
}
171
- match v {
171
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
172
172
& [ x.., _] => println ! ( "{:?}" , x) ,
173
173
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
174
174
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
175
175
_ => panic ! ( "other case" ) ,
176
176
}
177
- match v {
177
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
178
178
& [ _, x.., _] => println ! ( "{:?}" , x) ,
179
179
//[ast]~^ ERROR cannot use `v[..]` because it was mutably borrowed
180
180
//[mir]~^^ ERROR cannot use `v[..]` because it was mutably borrowed
@@ -187,7 +187,7 @@ fn main() {
187
187
188
188
let mut e = E :: A ( 3 ) ;
189
189
let _e = & mut e;
190
- match e {
190
+ match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
191
191
E :: A ( ref ax) =>
192
192
//[ast]~^ ERROR cannot borrow `e.0` as immutable because `e` is also borrowed as mutable
193
193
//[mir]~^^ ERROR cannot borrow `e.0` as immutable because it is also borrowed as mutable
@@ -205,14 +205,14 @@ fn main() {
205
205
struct S { x : F , y : ( u32 , u32 ) , } ;
206
206
let mut s = S { x : F { x : 1 , y : 2 } , y : ( 999 , 998 ) } ;
207
207
let _s = & mut s;
208
- match s {
208
+ match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
209
209
S { y : ( ref y0, _) , .. } =>
210
210
//[ast]~^ ERROR cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable
211
211
//[mir]~^^ ERROR cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
212
212
println ! ( "y0: {:?}" , y0) ,
213
213
_ => panic ! ( "other case" ) ,
214
214
}
215
- match s {
215
+ match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
216
216
S { x : F { y : ref x0, .. } , .. } =>
217
217
//[ast]~^ ERROR cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable
218
218
//[mir]~^^ ERROR cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
@@ -263,7 +263,7 @@ fn main() {
263
263
struct F { x : u32 , y : u32 } ;
264
264
let mut v = & [ F { x : 1 , y : 2 } , F { x : 3 , y : 4 } ] ;
265
265
let _v = & mut v;
266
- match v {
266
+ match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
267
267
& [ _, F { x : ref xf, ..} ] => println ! ( "{}" , xf) ,
268
268
//[mir]~^ ERROR cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
269
269
// No errors in AST
0 commit comments