1
1
error[E0308]: mismatched types
2
- --> $DIR/pattern-errors.rs:10 :17
2
+ --> $DIR/pattern-errors.rs:23 :17
3
3
|
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
+ | ^^^^^
13
6
|
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 `&`
17
9
|
18
- LL | if let Some(x) = &mut Some(&0 ) {
10
+ LL | if let Some(&Some(&_)) = &Some(&Some(0) ) {
19
11
| ~
20
12
21
13
error[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
34
15
|
35
16
LL | if let Some(&Some(&mut _)) = &Some(&mut Some(0)) {
36
17
| ^^^^^
@@ -42,7 +23,7 @@ LL | if let Some(&Some(&_)) = &Some(&mut Some(0)) {
42
23
| ~
43
24
44
25
error[E0308]: mismatched types
45
- --> $DIR/pattern-errors.rs:34 :23
26
+ --> $DIR/pattern-errors.rs:29 :23
46
27
|
47
28
LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) {
48
29
| ^^^^^
@@ -54,7 +35,7 @@ LL | if let Some(&Some(&_)) = &mut Some(&Some(0)) {
54
35
| ~
55
36
56
37
error[E0308]: mismatched types
57
- --> $DIR/pattern-errors.rs:37 :29
38
+ --> $DIR/pattern-errors.rs:32 :29
58
39
|
59
40
LL | if let Some(&Some(Some((&mut _)))) = &Some(Some(&mut Some(0))) {
60
41
| ^^^^^
@@ -66,7 +47,7 @@ LL | if let Some(&Some(Some((&_)))) = &Some(Some(&mut Some(0))) {
66
47
| ~
67
48
68
49
error[E0308]: mismatched types
69
- --> $DIR/pattern-errors.rs:40 :17
50
+ --> $DIR/pattern-errors.rs:35 :17
70
51
|
71
52
LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
72
53
| ^^^^^
@@ -78,7 +59,7 @@ LL | if let Some(&Some(x)) = &Some(Some(0)) {
78
59
| ~
79
60
80
61
error[E0308]: mismatched types
81
- --> $DIR/pattern-errors.rs:43 :17
62
+ --> $DIR/pattern-errors.rs:38 :17
82
63
|
83
64
LL | if let Some(&mut Some(x)) = &Some(Some(0)) {
84
65
| ^^^^^
@@ -90,7 +71,7 @@ LL | if let Some(&Some(x)) = &Some(Some(0)) {
90
71
| ~
91
72
92
73
error[E0308]: mismatched types
93
- --> $DIR/pattern-errors.rs:49 :11
74
+ --> $DIR/pattern-errors.rs:44 :11
94
75
|
95
76
LL | let &[&mut x] = &&mut [0];
96
77
| ^^^^^
@@ -102,7 +83,7 @@ LL | let &[&x] = &&mut [0];
102
83
| ~
103
84
104
85
error[E0308]: mismatched types
105
- --> $DIR/pattern-errors.rs:54 :11
86
+ --> $DIR/pattern-errors.rs:49 :11
106
87
|
107
88
LL | let &[&mut x] = &mut &mut [0];
108
89
| ^^^^^
@@ -114,7 +95,7 @@ LL | let &[&x] = &mut &mut [0];
114
95
| ~
115
96
116
97
error[E0308]: mismatched types
117
- --> $DIR/pattern-errors.rs:59 :11
98
+ --> $DIR/pattern-errors.rs:54 :11
118
99
|
119
100
LL | let &[&mut ref x] = &&mut [0];
120
101
| ^^^^^
@@ -126,7 +107,7 @@ LL | let &[&ref x] = &&mut [0];
126
107
| ~
127
108
128
109
error[E0308]: mismatched types
129
- --> $DIR/pattern-errors.rs:64 :11
110
+ --> $DIR/pattern-errors.rs:59 :11
130
111
|
131
112
LL | let &[&mut ref x] = &mut &mut [0];
132
113
| ^^^^^
@@ -138,7 +119,7 @@ LL | let &[&ref x] = &mut &mut [0];
138
119
| ~
139
120
140
121
error[E0308]: mismatched types
141
- --> $DIR/pattern-errors.rs:69 :11
122
+ --> $DIR/pattern-errors.rs:64 :11
142
123
|
143
124
LL | let &[&mut mut x] = &&mut [0];
144
125
| ^^^^^
@@ -150,7 +131,7 @@ LL | let &[&mut x] = &&mut [0];
150
131
| ~
151
132
152
133
error[E0308]: mismatched types
153
- --> $DIR/pattern-errors.rs:74 :11
134
+ --> $DIR/pattern-errors.rs:69 :11
154
135
|
155
136
LL | let &[&mut mut x] = &mut &mut [0];
156
137
| ^^^^^
@@ -162,7 +143,7 @@ LL | let &[&mut x] = &mut &mut [0];
162
143
| ~
163
144
164
145
error[E0658]: binding cannot be both mutable and by-reference
165
- --> $DIR/pattern-errors.rs:81 :12
146
+ --> $DIR/pattern-errors.rs:76 :12
166
147
|
167
148
LL | let [&(mut x)] = &[&0];
168
149
| ^^^^
@@ -172,7 +153,7 @@ LL | let [&(mut x)] = &[&0];
172
153
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
173
154
174
155
error[E0658]: binding cannot be both mutable and by-reference
175
- --> $DIR/pattern-errors.rs:85 :12
156
+ --> $DIR/pattern-errors.rs:80 :12
176
157
|
177
158
LL | let [&(mut x)] = &mut [&0];
178
159
| ^^^^
@@ -182,7 +163,7 @@ LL | let [&(mut x)] = &mut [&0];
182
163
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
183
164
184
165
error[E0308]: mismatched types
185
- --> $DIR/pattern-errors.rs:91 :11
166
+ --> $DIR/pattern-errors.rs:86 :11
186
167
|
187
168
LL | let [&&mut x] = &[&mut 0];
188
169
| ^^^^^
@@ -194,7 +175,7 @@ LL | let [&&x] = &[&mut 0];
194
175
| ~
195
176
196
177
error[E0308]: mismatched types
197
- --> $DIR/pattern-errors.rs:96 :11
178
+ --> $DIR/pattern-errors.rs:91 :11
198
179
|
199
180
LL | let [&&mut x] = &mut [&mut 0];
200
181
| ^^^^^
@@ -206,7 +187,7 @@ LL | let [&&x] = &mut [&mut 0];
206
187
| ~
207
188
208
189
error[E0308]: mismatched types
209
- --> $DIR/pattern-errors.rs:101 :11
190
+ --> $DIR/pattern-errors.rs:96 :11
210
191
|
211
192
LL | let [&&mut ref x] = &[&mut 0];
212
193
| ^^^^^
@@ -218,7 +199,7 @@ LL | let [&&ref x] = &[&mut 0];
218
199
| ~
219
200
220
201
error[E0308]: mismatched types
221
- --> $DIR/pattern-errors.rs:106 :11
202
+ --> $DIR/pattern-errors.rs:101 :11
222
203
|
223
204
LL | let [&&mut ref x] = &mut [&mut 0];
224
205
| ^^^^^
@@ -230,7 +211,7 @@ LL | let [&&ref x] = &mut [&mut 0];
230
211
| ~
231
212
232
213
error[E0308]: mismatched types
233
- --> $DIR/pattern-errors.rs:111 :11
214
+ --> $DIR/pattern-errors.rs:106 :11
234
215
|
235
216
LL | let [&&mut mut x] = &[&mut 0];
236
217
| ^^^^^
@@ -242,7 +223,7 @@ LL | let [&&mut x] = &[&mut 0];
242
223
| ~
243
224
244
225
error[E0308]: mismatched types
245
- --> $DIR/pattern-errors.rs:116 :11
226
+ --> $DIR/pattern-errors.rs:111 :11
246
227
|
247
228
LL | let [&&mut mut x] = &mut [&mut 0];
248
229
| ^^^^^
@@ -253,7 +234,7 @@ help: replace this `&mut` pattern with `&`
253
234
LL | let [&&mut x] = &mut [&mut 0];
254
235
| ~
255
236
256
- error: aborting due to 21 previous errors
237
+ error: aborting due to 20 previous errors
257
238
258
239
Some errors have detailed explanations: E0308, E0658.
259
240
For more information about an error, try `rustc --explain E0308`.
0 commit comments