@@ -58,155 +58,20 @@ LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
58
58
found mutable reference `&mut _`
59
59
60
60
error[E0308]: mismatched types
61
- --> $DIR/pattern-errors.rs:50:17
62
- |
63
- LL | if let Some(&Some(Some(&mut x))) = &Some(Some(&mut Some(0))) {
64
- | ^^^^^^^^^^^^^^^^^^^ ------------------------- this expression has type `&Option<Option<&mut Option<{integer}>>>`
65
- | |
66
- | expected `Option<&mut Option<{integer}>>`, found `&_`
67
- |
68
- = note: expected enum `Option<&mut Option<{integer}>>`
69
- found reference `&_`
70
-
71
- error[E0308]: mismatched types
72
- --> $DIR/pattern-errors.rs:57:17
61
+ --> $DIR/pattern-errors.rs:56:17
73
62
|
74
63
LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
75
- | ^^^^^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>`
76
- | |
77
- | expected `Option<{integer}>`, found `&mut _`
78
- |
79
- = note: expected enum `Option<{integer}>`
80
- found mutable reference `&mut _`
81
-
82
- error[E0308]: mismatched types
83
- --> $DIR/pattern-errors.rs:66:11
84
- |
85
- LL | let &[&mut x] = &&mut [0];
86
- | ^^^^^^ --------- this expression has type `&&mut [{integer}; 1]`
87
- | |
88
- | expected integer, found `&mut _`
89
- |
90
- = note: expected type `{integer}`
91
- found mutable reference `&mut _`
92
- note: to declare a mutable binding use: `mut x`
93
- --> $DIR/pattern-errors.rs:66:11
94
- |
95
- LL | let &[&mut x] = &&mut [0];
96
- | ^^^^^^
97
- help: consider removing `&mut` from the pattern
98
- |
99
- LL - let &[&mut x] = &&mut [0];
100
- LL + let &[x] = &&mut [0];
101
- |
102
-
103
- error[E0308]: mismatched types
104
- --> $DIR/pattern-errors.rs:73:11
105
- |
106
- LL | let &[&mut x] = &mut &mut [0];
107
- | ^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]`
108
- | |
109
- | expected integer, found `&mut _`
110
- |
111
- = note: expected type `{integer}`
112
- found mutable reference `&mut _`
113
- note: to declare a mutable binding use: `mut x`
114
- --> $DIR/pattern-errors.rs:73:11
115
- |
116
- LL | let &[&mut x] = &mut &mut [0];
117
- | ^^^^^^
118
- help: consider removing `&mut` from the pattern
119
- |
120
- LL - let &[&mut x] = &mut &mut [0];
121
- LL + let &[x] = &mut &mut [0];
122
- |
123
-
124
- error[E0308]: mismatched types
125
- --> $DIR/pattern-errors.rs:80:11
126
- |
127
- LL | let &[&mut ref x] = &&mut [0];
128
- | ^^^^^^^^^^ --------- this expression has type `&&mut [{integer}; 1]`
129
- | |
130
- | expected integer, found `&mut _`
131
- |
132
- = note: expected type `{integer}`
133
- found mutable reference `&mut _`
134
- note: to declare a mutable binding use: `mut x`
135
- --> $DIR/pattern-errors.rs:80:11
136
- |
137
- LL | let &[&mut ref x] = &&mut [0];
138
- | ^^^^^^^^^^
139
- help: consider removing `&mut` from the pattern
140
- |
141
- LL - let &[&mut ref x] = &&mut [0];
142
- LL + let &[ref x] = &&mut [0];
143
- |
144
-
145
- error[E0308]: mismatched types
146
- --> $DIR/pattern-errors.rs:87:11
147
- |
148
- LL | let &[&mut ref x] = &mut &mut [0];
149
- | ^^^^^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]`
150
- | |
151
- | expected integer, found `&mut _`
152
- |
153
- = note: expected type `{integer}`
154
- found mutable reference `&mut _`
155
- note: to declare a mutable binding use: `mut x`
156
- --> $DIR/pattern-errors.rs:87:11
157
- |
158
- LL | let &[&mut ref x] = &mut &mut [0];
159
- | ^^^^^^^^^^
160
- help: consider removing `&mut` from the pattern
161
- |
162
- LL - let &[&mut ref x] = &mut &mut [0];
163
- LL + let &[ref x] = &mut &mut [0];
164
- |
165
-
166
- error[E0308]: mismatched types
167
- --> $DIR/pattern-errors.rs:94:11
64
+ | ^^^^^
168
65
|
169
- LL | let &[&mut mut x] = &&mut [0];
170
- | ^^^^^^^^^^ --------- this expression has type `&&mut [{integer}; 1]`
171
- | |
172
- | expected integer, found `&mut _`
173
- |
174
- = note: expected type `{integer}`
175
- found mutable reference `&mut _`
176
- note: to declare a mutable binding use: `mut x`
177
- --> $DIR/pattern-errors.rs:94:11
178
- |
179
- LL | let &[&mut mut x] = &&mut [0];
180
- | ^^^^^^^^^^
181
- help: consider removing `&mut` from the pattern
182
- |
183
- LL - let &[&mut mut x] = &&mut [0];
184
- LL + let &[mut x] = &&mut [0];
185
- |
186
-
187
- error[E0308]: mismatched types
188
- --> $DIR/pattern-errors.rs:101:11
189
- |
190
- LL | let &[&mut mut x] = &mut &mut [0];
191
- | ^^^^^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]`
192
- | |
193
- | expected integer, found `&mut _`
194
- |
195
- = note: expected type `{integer}`
196
- found mutable reference `&mut _`
197
- note: to declare a mutable binding use: `mut x`
198
- --> $DIR/pattern-errors.rs:101:11
199
- |
200
- LL | let &[&mut mut x] = &mut &mut [0];
201
- | ^^^^^^^^^^
202
- help: consider removing `&mut` from the pattern
66
+ = note: cannot match inherited `&` with `&mut` pattern
67
+ help: replace this `&mut` pattern with `&`
203
68
|
204
- LL - let &[& mut mut x] = &mut &mut [0];
205
- LL + let &[mut x] = &mut &mut [0];
69
+ LL - if let Some(& mut Some(x)) = &Some(Some(0)) {
70
+ LL + if let Some(&Some(x)) = &Some(Some(0)) {
206
71
|
207
72
208
73
error[E0308]: mismatched types
209
- --> $DIR/pattern-errors.rs:122 :11
74
+ --> $DIR/pattern-errors.rs:114 :11
210
75
|
211
76
LL | let [&&mut x] = &[&mut 0];
212
77
| ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -222,7 +87,7 @@ LL + let [&x] = &[&mut 0];
222
87
|
223
88
224
89
error[E0308]: mismatched types
225
- --> $DIR/pattern-errors.rs:129 :11
90
+ --> $DIR/pattern-errors.rs:121 :11
226
91
|
227
92
LL | let [&&mut x] = &mut [&mut 0];
228
93
| ^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -238,7 +103,7 @@ LL + let [&x] = &mut [&mut 0];
238
103
|
239
104
240
105
error[E0308]: mismatched types
241
- --> $DIR/pattern-errors.rs:136 :11
106
+ --> $DIR/pattern-errors.rs:128 :11
242
107
|
243
108
LL | let [&&mut ref x] = &[&mut 0];
244
109
| ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -254,7 +119,7 @@ LL + let [&ref x] = &[&mut 0];
254
119
|
255
120
256
121
error[E0308]: mismatched types
257
- --> $DIR/pattern-errors.rs:143 :11
122
+ --> $DIR/pattern-errors.rs:135 :11
258
123
|
259
124
LL | let [&&mut ref x] = &mut [&mut 0];
260
125
| ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -270,7 +135,7 @@ LL + let [&ref x] = &mut [&mut 0];
270
135
|
271
136
272
137
error[E0308]: mismatched types
273
- --> $DIR/pattern-errors.rs:150 :11
138
+ --> $DIR/pattern-errors.rs:142 :11
274
139
|
275
140
LL | let [&&mut mut x] = &[&mut 0];
276
141
| ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -286,7 +151,7 @@ LL + let [&mut x] = &[&mut 0];
286
151
|
287
152
288
153
error[E0308]: mismatched types
289
- --> $DIR/pattern-errors.rs:157 :11
154
+ --> $DIR/pattern-errors.rs:149 :11
290
155
|
291
156
LL | let [&&mut mut x] = &mut [&mut 0];
292
157
| ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -302,7 +167,7 @@ LL + let [&mut x] = &mut [&mut 0];
302
167
|
303
168
304
169
error[E0308]: mismatched types
305
- --> $DIR/pattern-errors.rs:172 :15
170
+ --> $DIR/pattern-errors.rs:164 :15
306
171
|
307
172
LL | let [&mut &x] = &[&mut 0];
308
173
| ^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -318,7 +183,7 @@ LL + let [&mut x] = &[&mut 0];
318
183
|
319
184
320
185
error[E0308]: mismatched types
321
- --> $DIR/pattern-errors.rs:178 :15
186
+ --> $DIR/pattern-errors.rs:170 :15
322
187
|
323
188
LL | let [&mut &ref x] = &[&mut 0];
324
189
| ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -334,7 +199,7 @@ LL + let [&mut ref x] = &[&mut 0];
334
199
|
335
200
336
201
error[E0308]: mismatched types
337
- --> $DIR/pattern-errors.rs:184 :15
202
+ --> $DIR/pattern-errors.rs:176 :15
338
203
|
339
204
LL | let [&mut &(mut x)] = &[&mut 0];
340
205
| ^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -349,6 +214,6 @@ LL - let [&mut &(mut x)] = &[&mut 0];
349
214
LL + let [&mut mut x)] = &[&mut 0];
350
215
|
351
216
352
- error: aborting due to 21 previous errors
217
+ error: aborting due to 14 previous errors
353
218
354
219
For more information about this error, try `rustc --explain E0308`.
0 commit comments