Commit 0e64ced
authored
Rollup merge of #150121 - Zalathar:pin-pat, r=Nadrieril
mir_build: Don't use a mixture of THIR pattern kinds for pin-patterns
While looking for improvements to match-lowering, I had been trying to figure out why pin-patterns sometimes use `PatKind::Deref` and sometimes use `PatKind::DerefPattern`, which seemed confusing to me. In particular, both pattern kinds are being used with an inner type of `&` or `&mut`, which is very surprising.
The conclusion I came to was that `DerefPattern` (normally associated with calls to Deref/DerefMut) was only being used for *implicit* pin-patterns produced by match-ergonomics adjustment, whereas `Deref` was being used for explicit pin-patterns.
The inconsistency seems like a mistake to me, so this PR removes all uses of `DerefPattern` for pin-patterns, and consistently uses `PatKind::Deref` for pin-patterns instead. I'm not entirely happy with that outcome, because I think pin-patterns should probably have their own `thir::PatKind` variant, but this change will at least make that easier to achieve in a later PR.
r? NadrierilFile tree
6 files changed
+35
-40
lines changed- compiler
- rustc_hir_typeck/src
- rustc_middle/src
- ty
- rustc_mir_build/src
- builder/matches
- thir/pattern
6 files changed
+35
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
890 | 891 | | |
891 | 892 | | |
892 | 893 | | |
893 | | - | |
| 894 | + | |
894 | 895 | | |
895 | 896 | | |
896 | 897 | | |
| |||
1837 | 1838 | | |
1838 | 1839 | | |
1839 | 1840 | | |
1840 | | - | |
| 1841 | + | |
1841 | 1842 | | |
1842 | | - | |
| 1843 | + | |
1843 | 1844 | | |
1844 | 1845 | | |
1845 | 1846 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
811 | 811 | | |
812 | 812 | | |
813 | 813 | | |
814 | | - | |
| 814 | + | |
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
818 | | - | |
| 818 | + | |
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
| |||
879 | 879 | | |
880 | 880 | | |
881 | 881 | | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
882 | 888 | | |
883 | 889 | | |
884 | 890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
495 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
496 | 500 | | |
497 | | - | |
| 501 | + | |
498 | 502 | | |
499 | | - | |
500 | | - | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
501 | 506 | | |
502 | 507 | | |
503 | 508 | | |
| |||
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
287 | 286 | | |
288 | 287 | | |
289 | 288 | | |
| 289 | + | |
| 290 | + | |
290 | 291 | | |
291 | | - | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | 305 | | |
310 | | - | |
| 306 | + | |
311 | 307 | | |
312 | 308 | | |
313 | 309 | | |
| |||
320 | 316 | | |
321 | 317 | | |
322 | 318 | | |
323 | | - | |
| 319 | + | |
324 | 320 | | |
325 | 321 | | |
326 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
920 | 920 | | |
921 | 921 | | |
922 | 922 | | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | 923 | | |
928 | 924 | | |
929 | 925 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 117 | + | |
127 | 118 | | |
128 | 119 | | |
129 | 120 | | |
| |||
334 | 325 | | |
335 | 326 | | |
336 | 327 | | |
337 | | - | |
| 328 | + | |
338 | 329 | | |
339 | 330 | | |
340 | 331 | | |
| |||
0 commit comments