Commit 42b384e
committed
Auto merge of #147055 - beepster4096:subtype_is_not_a_projection, r=lcnr
Turn ProjectionElem::Subtype into CastKind::Subtype
I noticed that drop elaboration can't, in general, handle `ProjectionElem::SubType`. It creates a disjoint move path that overlaps with other move paths. (`Subslice` does too, and I'm working on a different PR to make that special case less fragile.) If its skipped and treated as the same move path as its parent then `MovePath.place` has multiple possible projections. (It would probably make sense to remove all `Subtype` projections for the canonical place but it doesn't make sense to have this special case for a problem that doesn't actually occur in real MIR.)
The only reason this doesn't break is that `Subtype` is always the sole projection of the local its applied to. For the same reason, it works fine as a `CastKind` so I figured that makes more sense than documenting and validating this hidden invariant.
cc #112651, #133258
r? Icnr (bc you've been the main person dealing with `Subtype` it looks like)File tree
34 files changed
+56
-121
lines changed- compiler
- rustc_borrowck/src
- diagnostics
- type_check
- rustc_codegen_cranelift/src
- rustc_codegen_ssa/src/mir
- rustc_const_eval/src
- check_consts
- interpret
- rustc_middle/src/mir
- rustc_mir_build/src/builder/expr
- rustc_mir_dataflow/src/move_paths
- rustc_mir_transform/src
- rustc_public/src
- mir
- unstable/convert
- stable
- src/tools/clippy/clippy_utils/src
- tests/crashes
34 files changed
+56
-121
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3968 | 3968 | | |
3969 | 3969 | | |
3970 | 3970 | | |
3971 | | - | |
3972 | 3971 | | |
3973 | 3972 | | |
3974 | 3973 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
406 | 405 | | |
407 | 406 | | |
408 | 407 | | |
| |||
484 | 483 | | |
485 | 484 | | |
486 | 485 | | |
487 | | - | |
488 | | - | |
489 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
490 | 489 | | |
491 | 490 | | |
492 | 491 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | 195 | | |
197 | 196 | | |
198 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1989 | 1989 | | |
1990 | 1990 | | |
1991 | 1991 | | |
1992 | | - | |
1993 | 1992 | | |
1994 | 1993 | | |
1995 | | - | |
1996 | 1994 | | |
1997 | 1995 | | |
1998 | 1996 | | |
| |||
2218 | 2216 | | |
2219 | 2217 | | |
2220 | 2218 | | |
2221 | | - | |
2222 | 2219 | | |
2223 | 2220 | | |
2224 | 2221 | | |
| |||
2610 | 2607 | | |
2611 | 2608 | | |
2612 | 2609 | | |
2613 | | - | |
2614 | 2610 | | |
2615 | 2611 | | |
2616 | 2612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | 252 | | |
254 | 253 | | |
255 | 254 | | |
| |||
510 | 509 | | |
511 | 510 | | |
512 | 511 | | |
513 | | - | |
514 | 512 | | |
515 | 513 | | |
516 | 514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 80 | | |
84 | 81 | | |
85 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1558 | 1558 | | |
1559 | 1559 | | |
1560 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
1561 | 1564 | | |
1562 | 1565 | | |
1563 | 1566 | | |
| |||
1882 | 1885 | | |
1883 | 1886 | | |
1884 | 1887 | | |
1885 | | - | |
1886 | | - | |
1887 | | - | |
1888 | 1888 | | |
1889 | 1889 | | |
1890 | 1890 | | |
| |||
2412 | 2412 | | |
2413 | 2413 | | |
2414 | 2414 | | |
2415 | | - | |
2416 | | - | |
2417 | | - | |
2418 | 2415 | | |
2419 | 2416 | | |
2420 | 2417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
| 792 | + | |
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
| |||
996 | 996 | | |
997 | 997 | | |
998 | 998 | | |
999 | | - | |
| 999 | + | |
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
663 | | - | |
| 663 | + | |
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | 153 | | |
158 | 154 | | |
159 | 155 | | |
| |||
0 commit comments