@@ -56,155 +56,19 @@ LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
5656 found mutable reference `&mut _`
5757
5858error[E0308]: mismatched types
59- --> $DIR/pattern-errors.rs:50:17
60- |
61- LL | if let Some(&Some(Some(&mut x))) = &Some(Some(&mut Some(0))) {
62- | ^^^^^^^^^^^^^^^^^^^ ------------------------- this expression has type `&Option<Option<&mut Option<{integer}>>>`
63- | |
64- | expected `Option<&mut Option<{integer}>>`, found `&_`
65- |
66- = note: expected enum `Option<&mut Option<{integer}>>`
67- found reference `&_`
68-
69- error[E0308]: mismatched types
70- --> $DIR/pattern-errors.rs:57:17
59+ --> $DIR/pattern-errors.rs:56:17
7160 |
7261LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
73- | ^^^^^^^^^^^^ -------------- this expression has type `&Option<Option<{integer}>>`
74- | |
75- | expected `Option<{integer}>`, found `&mut _`
76- |
77- = note: expected enum `Option<{integer}>`
78- found mutable reference `&mut _`
79-
80- error[E0308]: mismatched types
81- --> $DIR/pattern-errors.rs:66:11
82- |
83- LL | let &[&mut x] = &&mut [0];
84- | ^^^^^^ --------- this expression has type `&&mut [{integer}; 1]`
85- | |
86- | expected integer, found `&mut _`
87- |
88- = note: expected type `{integer}`
89- found mutable reference `&mut _`
90- note: to declare a mutable binding use: `mut x`
91- --> $DIR/pattern-errors.rs:66:11
92- |
93- LL | let &[&mut x] = &&mut [0];
94- | ^^^^^^
95- help: consider removing `&mut` from the pattern
96- |
97- LL - let &[&mut x] = &&mut [0];
98- LL + let &[x] = &&mut [0];
99- |
100-
101- error[E0308]: mismatched types
102- --> $DIR/pattern-errors.rs:73:11
103- |
104- LL | let &[&mut x] = &mut &mut [0];
105- | ^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]`
106- | |
107- | expected integer, found `&mut _`
108- |
109- = note: expected type `{integer}`
110- found mutable reference `&mut _`
111- note: to declare a mutable binding use: `mut x`
112- --> $DIR/pattern-errors.rs:73:11
113- |
114- LL | let &[&mut x] = &mut &mut [0];
115- | ^^^^^^
116- help: consider removing `&mut` from the pattern
117- |
118- LL - let &[&mut x] = &mut &mut [0];
119- LL + let &[x] = &mut &mut [0];
120- |
121-
122- error[E0308]: mismatched types
123- --> $DIR/pattern-errors.rs:80:11
124- |
125- LL | let &[&mut ref x] = &&mut [0];
126- | ^^^^^^^^^^ --------- this expression has type `&&mut [{integer}; 1]`
127- | |
128- | expected integer, found `&mut _`
129- |
130- = note: expected type `{integer}`
131- found mutable reference `&mut _`
132- note: to declare a mutable binding use: `mut x`
133- --> $DIR/pattern-errors.rs:80:11
134- |
135- LL | let &[&mut ref x] = &&mut [0];
136- | ^^^^^^^^^^
137- help: consider removing `&mut` from the pattern
138- |
139- LL - let &[&mut ref x] = &&mut [0];
140- LL + let &[ref x] = &&mut [0];
141- |
142-
143- error[E0308]: mismatched types
144- --> $DIR/pattern-errors.rs:87:11
145- |
146- LL | let &[&mut ref x] = &mut &mut [0];
147- | ^^^^^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]`
148- | |
149- | expected integer, found `&mut _`
150- |
151- = note: expected type `{integer}`
152- found mutable reference `&mut _`
153- note: to declare a mutable binding use: `mut x`
154- --> $DIR/pattern-errors.rs:87:11
155- |
156- LL | let &[&mut ref x] = &mut &mut [0];
157- | ^^^^^^^^^^
158- help: consider removing `&mut` from the pattern
159- |
160- LL - let &[&mut ref x] = &mut &mut [0];
161- LL + let &[ref x] = &mut &mut [0];
162- |
163-
164- error[E0308]: mismatched types
165- --> $DIR/pattern-errors.rs:94:11
166- |
167- LL | let &[&mut mut x] = &&mut [0];
168- | ^^^^^^^^^^ --------- this expression has type `&&mut [{integer}; 1]`
169- | |
170- | expected integer, found `&mut _`
171- |
172- = note: expected type `{integer}`
173- found mutable reference `&mut _`
174- note: to declare a mutable binding use: `mut x`
175- --> $DIR/pattern-errors.rs:94:11
176- |
177- LL | let &[&mut mut x] = &&mut [0];
178- | ^^^^^^^^^^
179- help: consider removing `&mut` from the pattern
180- |
181- LL - let &[&mut mut x] = &&mut [0];
182- LL + let &[mut x] = &&mut [0];
183- |
184-
185- error[E0308]: mismatched types
186- --> $DIR/pattern-errors.rs:101:11
187- |
188- LL | let &[&mut mut x] = &mut &mut [0];
189- | ^^^^^^^^^^ ------------- this expression has type `&mut &mut [{integer}; 1]`
190- | |
191- | expected integer, found `&mut _`
192- |
193- = note: expected type `{integer}`
194- found mutable reference `&mut _`
195- note: to declare a mutable binding use: `mut x`
196- --> $DIR/pattern-errors.rs:101:11
197- |
198- LL | let &[&mut mut x] = &mut &mut [0];
199- | ^^^^^^^^^^
200- help: consider removing `&mut` from the pattern
62+ | ^^^^^
20163 |
202- LL - let &[&mut mut x] = &mut &mut [0];
203- LL + let &[ mut x] = &mut &mut [0];
64+ = note: cannot match inherited `&` with ` &mut` pattern
65+ help: replace this `& mut` pattern with `&`
20466 |
67+ LL | if let Some(&Some(x)) = &Some(Some(0)) {
68+ | ~
20569
20670error[E0308]: mismatched types
207- --> $DIR/pattern-errors.rs:122 :11
71+ --> $DIR/pattern-errors.rs:114 :11
20872 |
20973LL | let [&&mut x] = &[&mut 0];
21074 | ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -220,7 +84,7 @@ LL + let [&x] = &[&mut 0];
22084 |
22185
22286error[E0308]: mismatched types
223- --> $DIR/pattern-errors.rs:129 :11
87+ --> $DIR/pattern-errors.rs:121 :11
22488 |
22589LL | let [&&mut x] = &mut [&mut 0];
22690 | ^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -236,7 +100,7 @@ LL + let [&x] = &mut [&mut 0];
236100 |
237101
238102error[E0308]: mismatched types
239- --> $DIR/pattern-errors.rs:136 :11
103+ --> $DIR/pattern-errors.rs:128 :11
240104 |
241105LL | let [&&mut ref x] = &[&mut 0];
242106 | ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -252,7 +116,7 @@ LL + let [&ref x] = &[&mut 0];
252116 |
253117
254118error[E0308]: mismatched types
255- --> $DIR/pattern-errors.rs:143 :11
119+ --> $DIR/pattern-errors.rs:135 :11
256120 |
257121LL | let [&&mut ref x] = &mut [&mut 0];
258122 | ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -268,7 +132,7 @@ LL + let [&ref x] = &mut [&mut 0];
268132 |
269133
270134error[E0308]: mismatched types
271- --> $DIR/pattern-errors.rs:150 :11
135+ --> $DIR/pattern-errors.rs:142 :11
272136 |
273137LL | let [&&mut mut x] = &[&mut 0];
274138 | ^^^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -284,7 +148,7 @@ LL + let [&mut x] = &[&mut 0];
284148 |
285149
286150error[E0308]: mismatched types
287- --> $DIR/pattern-errors.rs:157 :11
151+ --> $DIR/pattern-errors.rs:149 :11
288152 |
289153LL | let [&&mut mut x] = &mut [&mut 0];
290154 | ^^^^^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
@@ -300,7 +164,7 @@ LL + let [&mut x] = &mut [&mut 0];
300164 |
301165
302166error[E0308]: mismatched types
303- --> $DIR/pattern-errors.rs:172 :15
167+ --> $DIR/pattern-errors.rs:164 :15
304168 |
305169LL | let [&mut &x] = &[&mut 0];
306170 | ^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -316,7 +180,7 @@ LL + let [&mut x] = &[&mut 0];
316180 |
317181
318182error[E0308]: mismatched types
319- --> $DIR/pattern-errors.rs:178 :15
183+ --> $DIR/pattern-errors.rs:170 :15
320184 |
321185LL | let [&mut &ref x] = &[&mut 0];
322186 | ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -332,7 +196,7 @@ LL + let [&mut ref x] = &[&mut 0];
332196 |
333197
334198error[E0308]: mismatched types
335- --> $DIR/pattern-errors.rs:184 :15
199+ --> $DIR/pattern-errors.rs:176 :15
336200 |
337201LL | let [&mut &(mut x)] = &[&mut 0];
338202 | ^^^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
@@ -347,6 +211,6 @@ LL - let [&mut &(mut x)] = &[&mut 0];
347211LL + let [&mut mut x)] = &[&mut 0];
348212 |
349213
350- error: aborting due to 21 previous errors
214+ error: aborting due to 14 previous errors
351215
352216For more information about this error, try `rustc --explain E0308`.
0 commit comments