Commit 943f454
committed
Arbitrary self types v2: avoid dyn, generic ICE
Bug #57276 (and several duplicates) is an ICE which occurs when a generic type
is used as a receiver which implements both Receiver and DispatchFromDyn.
This change proposes to detect this error condition and turn it into a regular
error rather than an ICE. Future changes could liberalise things here.
As this same code path currently produces an ICE, this seems to be strictly
better, and it seems defensible to inform the user that their
excessively generic type is not dyn-safe.
This is somewhat related to the stabilization of arbitrary self types in
PR #135881, tracked in #44874.1 parent aa6f5ab commit 943f454
File tree
6 files changed
+61
-26
lines changed- compiler
- rustc_middle/src/traits
- rustc_trait_selection/src/traits
- tests
- crashes
- ui/self
6 files changed
+61
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
789 | 792 | | |
790 | 793 | | |
791 | 794 | | |
| |||
853 | 856 | | |
854 | 857 | | |
855 | 858 | | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
856 | 862 | | |
857 | 863 | | |
858 | 864 | | |
859 | 865 | | |
860 | 866 | | |
861 | 867 | | |
862 | 868 | | |
863 | | - | |
864 | | - | |
865 | | - | |
| 869 | + | |
| 870 | + | |
866 | 871 | | |
867 | 872 | | |
868 | 873 | | |
| |||
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | | - | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
| 505 | + | |
| 506 | + | |
504 | 507 | | |
505 | 508 | | |
506 | | - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
507 | 515 | | |
508 | 516 | | |
509 | 517 | | |
| |||
522 | 530 | | |
523 | 531 | | |
524 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
525 | 536 | | |
526 | 537 | | |
527 | 538 | | |
| |||
537 | 548 | | |
538 | 549 | | |
539 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
540 | 554 | | |
541 | 555 | | |
542 | 556 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments