@@ -58,155 +58,20 @@ LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
5858 found mutable reference `&mut _`
5959
6060error[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
7362 |
7463LL | 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+ | ^^^^^
16865 |
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 `&`
20368 |
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)) {
20671 |
20772
20873error[E0308]: mismatched types
209- --> $DIR/pattern-errors.rs:122 :11
74+ --> $DIR/pattern-errors.rs:114 :11
21075 |
21176LL | let [&&mut x] = &[&mut 0];
21277 | ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -222,7 +87,7 @@ LL + let [&x] = &[&mut 0];
22287 |
22388
22489error[E0308]: mismatched types
225- --> $DIR/pattern-errors.rs:129 :11
90+ --> $DIR/pattern-errors.rs:121 :11
22691 |
22792LL | let [&&mut x] = &mut [&mut 0];
22893 | ^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -238,7 +103,7 @@ LL + let [&x] = &mut [&mut 0];
238103 |
239104
240105error[E0308]: mismatched types
241- --> $DIR/pattern-errors.rs:136 :11
106+ --> $DIR/pattern-errors.rs:128 :11
242107 |
243108LL | let [&&mut ref x] = &[&mut 0];
244109 | ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -254,7 +119,7 @@ LL + let [&ref x] = &[&mut 0];
254119 |
255120
256121error[E0308]: mismatched types
257- --> $DIR/pattern-errors.rs:143 :11
122+ --> $DIR/pattern-errors.rs:135 :11
258123 |
259124LL | let [&&mut ref x] = &mut [&mut 0];
260125 | ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -270,7 +135,7 @@ LL + let [&ref x] = &mut [&mut 0];
270135 |
271136
272137error[E0308]: mismatched types
273- --> $DIR/pattern-errors.rs:150 :11
138+ --> $DIR/pattern-errors.rs:142 :11
274139 |
275140LL | let [&&mut mut x] = &[&mut 0];
276141 | ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -286,7 +151,7 @@ LL + let [&mut x] = &[&mut 0];
286151 |
287152
288153error[E0308]: mismatched types
289- --> $DIR/pattern-errors.rs:157 :11
154+ --> $DIR/pattern-errors.rs:149 :11
290155 |
291156LL | let [&&mut mut x] = &mut [&mut 0];
292157 | ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -302,7 +167,7 @@ LL + let [&mut x] = &mut [&mut 0];
302167 |
303168
304169error[E0308]: mismatched types
305- --> $DIR/pattern-errors.rs:172 :15
170+ --> $DIR/pattern-errors.rs:164 :15
306171 |
307172LL | let [&mut &x] = &[&mut 0];
308173 | ^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -318,7 +183,7 @@ LL + let [&mut x] = &[&mut 0];
318183 |
319184
320185error[E0308]: mismatched types
321- --> $DIR/pattern-errors.rs:178 :15
186+ --> $DIR/pattern-errors.rs:170 :15
322187 |
323188LL | let [&mut &ref x] = &[&mut 0];
324189 | ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -334,7 +199,7 @@ LL + let [&mut ref x] = &[&mut 0];
334199 |
335200
336201error[E0308]: mismatched types
337- --> $DIR/pattern-errors.rs:184 :15
202+ --> $DIR/pattern-errors.rs:176 :15
338203 |
339204LL | let [&mut &(mut x)] = &[&mut 0];
340205 | ^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -349,6 +214,6 @@ LL - let [&mut &(mut x)] = &[&mut 0];
349214LL + let [&mut mut x)] = &[&mut 0];
350215 |
351216
352- error: aborting due to 21 previous errors
217+ error: aborting due to 14 previous errors
353218
354219For more information about this error, try `rustc --explain E0308`.
0 commit comments