Commit bf6c007
committed
Change
This implements RFC 179 by making the pattern `&<pat>` require matching
against a variable of type `&T`, and introducing the pattern `&mut
<pat>` which only works with variables of type `&mut T`.
The pattern `&mut x` currently parses as `&(mut x)` i.e. a pattern match
through a `&T` or a `&mut T` that binds the variable `x` to have type
`T` and to be mutable. This should be rewritten as follows, for example,
for &mut x in slice.iter() {
becomes
for &x in slice.iter() {
let mut x = x;
Due to this, this is a
[breaking-change]
Closes rust-lang#20496.& pat to only work with &T, and &mut with &mut T.1 parent 5773bde commit bf6c007
File tree
19 files changed
+91
-25
lines changed- src
- doc
- libcore/str
- librustc_trans/trans
- librustc_typeck/check
- librustc/middle
- cfg
- librustdoc/clean
- libsyntax
- ext/deriving/generic
- parse
- print
- libtest
- test/compile-fail
19 files changed
+91
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3484 | 3484 | | |
3485 | 3485 | | |
3486 | 3486 | | |
3487 | | - | |
3488 | | - | |
| 3487 | + | |
| 3488 | + | |
| 3489 | + | |
3489 | 3490 | | |
3490 | 3491 | | |
3491 | 3492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
| 476 | + | |
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| |||
860 | 860 | | |
861 | 861 | | |
862 | 862 | | |
863 | | - | |
| 863 | + | |
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1262 | 1262 | | |
1263 | 1263 | | |
1264 | 1264 | | |
1265 | | - | |
1266 | | - | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
1267 | 1269 | | |
1268 | 1270 | | |
1269 | 1271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
686 | | - | |
| 686 | + | |
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
| |||
1725 | 1725 | | |
1726 | 1726 | | |
1727 | 1727 | | |
1728 | | - | |
| 1728 | + | |
1729 | 1729 | | |
1730 | 1730 | | |
1731 | 1731 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3472 | 3472 | | |
3473 | 3473 | | |
3474 | 3474 | | |
3475 | | - | |
| 3475 | + | |
3476 | 3476 | | |
3477 | 3477 | | |
3478 | 3478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
| 153 | + | |
153 | 154 | | |
154 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
155 | 159 | | |
156 | 160 | | |
157 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2235 | 2235 | | |
2236 | 2236 | | |
2237 | 2237 | | |
2238 | | - | |
| 2238 | + | |
2239 | 2239 | | |
2240 | 2240 | | |
2241 | 2241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
559 | | - | |
| 559 | + | |
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| |||
0 commit comments