This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit af54b60
committed
Auto merge of rust-lang#138952 - dingxiangfei2009:implicit-receiver-impl, r=<try>
arbitrary_self_type: insert implied Receiver bound on Deref
r? `@nikomatsakis`
This is an experimental setup which allows us to assess the impact from inserting an implied supertrait bound `Deref: Receiver`.
The observations are as follows.
- Thanks to the trait solver, not too many hacks are needed to implement the idea behind [this comment](rust-lang#135881 (comment)), where inductive cycles are admissible.
- We want to allow users to continue use the `dyn Deref` type as `Deref` has been `dyn`-compatible. Following the current `dyn`-compatibility rule, it would have been impossible to use `dyn Deref<Target = ..>` because one would need to write `dyn Deref<..> + Receiver<..>` while neither `Deref` nor `Receiver` is an `auto` trait. This is the main change that this PR proposes: we fill in the missing projection bound that `Receiver` demands from a `dyn Deref` and this will remain the only exception.
- Finally, the type (pretty-)printing is adjusted so as to not present the frivolous `Receiver::Target = ..` bound. It will always be the same term as `Deref::Target`.
I am proposing a crater experiment to see the extent of impact on the existing ecosystem and explore corner cases that I have missed.File tree
12 files changed
+327
-339
lines changed- compiler
- rustc_hir_analysis/src/hir_ty_lowering
- rustc_middle/src/ty
- print
- library/core/src/ops
- tests/ui
- associated-types
- attributes
12 files changed
+327
-339
lines changedLines changed: 41 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
115 | 133 | | |
| 134 | + | |
| 135 | + | |
116 | 136 | | |
117 | | - | |
| 137 | + | |
118 | 138 | | |
119 | 139 | | |
120 | 140 | | |
| |||
142 | 162 | | |
143 | 163 | | |
144 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
145 | 168 | | |
146 | 169 | | |
147 | 170 | | |
| |||
221 | 244 | | |
222 | 245 | | |
223 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
224 | 255 | | |
225 | 256 | | |
226 | 257 | | |
| |||
233 | 264 | | |
234 | 265 | | |
235 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
236 | 272 | | |
237 | 273 | | |
238 | 274 | | |
| |||
264 | 300 | | |
265 | 301 | | |
266 | 302 | | |
| 303 | + | |
267 | 304 | | |
268 | 305 | | |
269 | 306 | | |
| |||
378 | 415 | | |
379 | 416 | | |
380 | 417 | | |
| 418 | + | |
381 | 419 | | |
382 | 420 | | |
383 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1036 | 1036 | | |
1037 | 1037 | | |
1038 | 1038 | | |
1039 | | - | |
1040 | | - | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1041 | 1058 | | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
| 1059 | + | |
1060 | 1060 | | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1087 | 1102 | | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1093 | 1106 | | |
1094 | | - | |
1095 | | - | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1096 | 1112 | | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
| 1113 | + | |
| 1114 | + | |
1104 | 1115 | | |
1105 | 1116 | | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
1110 | 1123 | | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
1117 | 1128 | | |
1118 | | - | |
1119 | | - | |
1120 | 1129 | | |
1121 | | - | |
1122 | 1130 | | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
1123 | 1141 | | |
1124 | 1142 | | |
1125 | 1143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1392 | 1392 | | |
1393 | 1393 | | |
1394 | 1394 | | |
| 1395 | + | |
| 1396 | + | |
1395 | 1397 | | |
1396 | 1398 | | |
1397 | 1399 | | |
| |||
1451 | 1453 | | |
1452 | 1454 | | |
1453 | 1455 | | |
1454 | | - | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
1455 | 1461 | | |
1456 | 1462 | | |
1457 | 1463 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
742 | 738 | | |
743 | | - | |
| 739 | + | |
| 740 | + | |
744 | 741 | | |
745 | 742 | | |
746 | 743 | | |
| |||
0 commit comments