11error[E0308]: mismatched types
2-   --> $DIR/pattern-errors.rs:10 :17
2+   --> $DIR/pattern-errors.rs:23 :17
33   |
4- LL |     if let Some(&mut x) = &mut Some(&0) {
5-    |                 ^^^^^^    ------------- this expression has type `&mut Option<&{integer}>`
6-    |                 |
7-    |                 types differ in mutability
8-    |
9-    = note:      expected reference `&{integer}`
10-            found mutable reference `&mut _`
11- note: to declare a mutable binding use: `mut x`
12-   --> $DIR/pattern-errors.rs:10:17
4+ LL |     if let Some(&mut Some(&_)) = &Some(&Some(0)) {
5+    |                 ^^^^^
136   |
14- LL |     if let Some(&mut x) = &mut Some(&0) {
15-    |                 ^^^^^^
16- help: consider removing `&mut` from the pattern
7+    = note: cannot match inherited `&` with `&mut` pattern
8+ help: replace this `&mut` pattern with `&`
179   |
18- LL |     if let Some(x)  = &mut  Some(&0 ) {
10+ LL |     if let Some(&Some(&_))  = &Some(&Some(0) ) {
1911   |                 ~
2012
2113error[E0308]: mismatched types
22-   --> $DIR/pattern-errors.rs:28:17
23-    |
24- LL |     if let Some(&mut Some(&_)) = &Some(&Some(0)) {
25-    |                 ^^^^^^^^^^^^^    --------------- this expression has type `&Option<&Option<{integer}>>`
26-    |                 |
27-    |                 types differ in mutability
28-    |
29-    = note:      expected reference `&Option<{integer}>`
30-            found mutable reference `&mut _`
31- 
32- error[E0308]: mismatched types
33-   --> $DIR/pattern-errors.rs:31:23
14+   --> $DIR/pattern-errors.rs:26:23
3415   |
3516LL |     if let Some(&Some(&mut _)) = &Some(&mut Some(0)) {
3617   |                       ^^^^^
@@ -42,7 +23,7 @@ LL |     if let Some(&Some(&_)) = &Some(&mut Some(0)) {
4223   |                       ~
4324
4425error[E0308]: mismatched types
45-   --> $DIR/pattern-errors.rs:34 :23
26+   --> $DIR/pattern-errors.rs:29 :23
4627   |
4728LL |     if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
4829   |                       ^^^^^
@@ -54,7 +35,7 @@ LL |     if let Some(&Some(&_)) = &mut Some(&Some(0)) {
5435   |                       ~
5536
5637error[E0308]: mismatched types
57-   --> $DIR/pattern-errors.rs:37 :29
38+   --> $DIR/pattern-errors.rs:32 :29
5839   |
5940LL |     if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) {
6041   |                             ^^^^^
@@ -66,7 +47,7 @@ LL |     if let Some(&Some(Some((&_)))) = &Some(Some(&mut Some(0))) {
6647   |                             ~
6748
6849error[E0308]: mismatched types
69-   --> $DIR/pattern-errors.rs:40 :17
50+   --> $DIR/pattern-errors.rs:35 :17
7051   |
7152LL |     if let Some(&mut Some(x)) = &Some(Some(0)) {
7253   |                 ^^^^^
@@ -78,7 +59,7 @@ LL |     if let Some(&Some(x)) = &Some(Some(0)) {
7859   |                 ~
7960
8061error[E0308]: mismatched types
81-   --> $DIR/pattern-errors.rs:43 :17
62+   --> $DIR/pattern-errors.rs:38 :17
8263   |
8364LL |     if let Some(&mut Some(x)) = &Some(Some(0)) {
8465   |                 ^^^^^
@@ -90,7 +71,7 @@ LL |     if let Some(&Some(x)) = &Some(Some(0)) {
9071   |                 ~
9172
9273error[E0308]: mismatched types
93-   --> $DIR/pattern-errors.rs:49 :11
74+   --> $DIR/pattern-errors.rs:44 :11
9475   |
9576LL |     let &[&mut x] = &&mut [0];
9677   |           ^^^^^
@@ -102,7 +83,7 @@ LL |     let &[&x] = &&mut [0];
10283   |           ~
10384
10485error[E0308]: mismatched types
105-   --> $DIR/pattern-errors.rs:54 :11
86+   --> $DIR/pattern-errors.rs:49 :11
10687   |
10788LL |     let &[&mut x] = &mut &mut [0];
10889   |           ^^^^^
@@ -114,7 +95,7 @@ LL |     let &[&x] = &mut &mut [0];
11495   |           ~
11596
11697error[E0308]: mismatched types
117-   --> $DIR/pattern-errors.rs:59 :11
98+   --> $DIR/pattern-errors.rs:54 :11
11899   |
119100LL |     let &[&mut ref x] = &&mut [0];
120101   |           ^^^^^
@@ -126,7 +107,7 @@ LL |     let &[&ref x] = &&mut [0];
126107   |           ~
127108
128109error[E0308]: mismatched types
129-   --> $DIR/pattern-errors.rs:64 :11
110+   --> $DIR/pattern-errors.rs:59 :11
130111   |
131112LL |     let &[&mut ref x] = &mut &mut [0];
132113   |           ^^^^^
@@ -138,7 +119,7 @@ LL |     let &[&ref x] = &mut &mut [0];
138119   |           ~
139120
140121error[E0308]: mismatched types
141-   --> $DIR/pattern-errors.rs:69 :11
122+   --> $DIR/pattern-errors.rs:64 :11
142123   |
143124LL |     let &[&mut mut x] = &&mut [0];
144125   |           ^^^^^
@@ -150,7 +131,7 @@ LL |     let &[&mut x] = &&mut [0];
150131   |           ~
151132
152133error[E0308]: mismatched types
153-   --> $DIR/pattern-errors.rs:74 :11
134+   --> $DIR/pattern-errors.rs:69 :11
154135   |
155136LL |     let &[&mut mut x] = &mut &mut [0];
156137   |           ^^^^^
@@ -162,7 +143,7 @@ LL |     let &[&mut x] = &mut &mut [0];
162143   |           ~
163144
164145error[E0658]: binding cannot be both mutable and by-reference
165-   --> $DIR/pattern-errors.rs:81 :12
146+   --> $DIR/pattern-errors.rs:76 :12
166147   |
167148LL |     let [&(mut x)] = &[&0];
168149   |            ^^^^
@@ -172,7 +153,7 @@ LL |     let [&(mut x)] = &[&0];
172153   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
173154
174155error[E0658]: binding cannot be both mutable and by-reference
175-   --> $DIR/pattern-errors.rs:85 :12
156+   --> $DIR/pattern-errors.rs:80 :12
176157   |
177158LL |     let [&(mut x)] = &mut [&0];
178159   |            ^^^^
@@ -182,7 +163,7 @@ LL |     let [&(mut x)] = &mut [&0];
182163   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
183164
184165error[E0308]: mismatched types
185-   --> $DIR/pattern-errors.rs:91 :11
166+   --> $DIR/pattern-errors.rs:86 :11
186167   |
187168LL |     let [&&mut x] = &[&mut 0];
188169   |           ^^^^^
@@ -194,7 +175,7 @@ LL |     let [&&x] = &[&mut 0];
194175   |           ~
195176
196177error[E0308]: mismatched types
197-   --> $DIR/pattern-errors.rs:96 :11
178+   --> $DIR/pattern-errors.rs:91 :11
198179   |
199180LL |     let [&&mut x] = &mut [&mut 0];
200181   |           ^^^^^
@@ -206,7 +187,7 @@ LL |     let [&&x] = &mut [&mut 0];
206187   |           ~
207188
208189error[E0308]: mismatched types
209-   --> $DIR/pattern-errors.rs:101 :11
190+   --> $DIR/pattern-errors.rs:96 :11
210191   |
211192LL |     let [&&mut ref x] = &[&mut 0];
212193   |           ^^^^^
@@ -218,7 +199,7 @@ LL |     let [&&ref x] = &[&mut 0];
218199   |           ~
219200
220201error[E0308]: mismatched types
221-   --> $DIR/pattern-errors.rs:106 :11
202+   --> $DIR/pattern-errors.rs:101 :11
222203   |
223204LL |     let [&&mut ref x] = &mut [&mut 0];
224205   |           ^^^^^
@@ -230,7 +211,7 @@ LL |     let [&&ref x] = &mut [&mut 0];
230211   |           ~
231212
232213error[E0308]: mismatched types
233-   --> $DIR/pattern-errors.rs:111 :11
214+   --> $DIR/pattern-errors.rs:106 :11
234215   |
235216LL |     let [&&mut mut x] = &[&mut 0];
236217   |           ^^^^^
@@ -242,7 +223,7 @@ LL |     let [&&mut x] = &[&mut 0];
242223   |           ~
243224
244225error[E0308]: mismatched types
245-   --> $DIR/pattern-errors.rs:116 :11
226+   --> $DIR/pattern-errors.rs:111 :11
246227   |
247228LL |     let [&&mut mut x] = &mut [&mut 0];
248229   |           ^^^^^
@@ -253,7 +234,7 @@ help: replace this `&mut` pattern with `&`
253234LL |     let [&&mut x] = &mut [&mut 0];
254235   |           ~
255236
256- error: aborting due to 21  previous errors
237+ error: aborting due to 20  previous errors
257238
258239Some errors have detailed explanations: E0308, E0658.
259240For more information about an error, try `rustc --explain E0308`.
0 commit comments