Commit 54a8a1d
committed
Auto merge of rust-lang#146885 - lcnr:method-selection-opaques, r=BoxyUwU
support opaque types in method selection
See my notes in https://hackmd.io/4ILASx3mQ3u_gW9r1JyqCw.
This PR builds on rust-lang#145993 and allows not-yet defined opaque types as self types in the `method_autoderef_chain`.
E.g. for `Box<impl Deref<impl Foo>>` this results in the autoderef chain `Box<impl Deref> -> ?deref_hidden_ty -> ?foo_hidden_ty`. Method selection stays ambiguous if the final autoderef step is still an infer var unless that var is an opaque.
TODO: treating opaques as rigid jank.
r? `@BoxyUwU`File tree
64 files changed
+647
-291
lines changed- compiler
- rustc_hir_typeck/src
- method
- rustc_infer/src/infer/canonical
- rustc_middle/src
- query
- traits
- ty
- rustc_next_trait_solver/src
- canonical
- solve
- eval_ctxt
- rustc_trait_selection/src/traits/query
- rustc_type_ir/src
- solve
- tests/ui
- closures/deduce-signature
- impl-trait
- method
- inference/need_type_info
- issues
- lazy-type-alias-impl-trait
- proc-macro/quote
- repeat-expr
- span
- type-alias-impl-trait
- type-inference
- typeck
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
64 files changed
+647
-291
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1633 | 1633 | | |
1634 | 1634 | | |
1635 | 1635 | | |
1636 | | - | |
1637 | | - | |
| 1636 | + | |
1638 | 1637 | | |
1639 | 1638 | | |
1640 | 1639 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
187 | 185 | | |
188 | 186 | | |
189 | 187 | | |
| |||
Large diffs are not rendered by default.
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
88 | 106 | | |
89 | 107 | | |
90 | 108 | | |
91 | 109 | | |
92 | | - | |
| 110 | + | |
93 | 111 | | |
94 | 112 | | |
95 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
2559 | 2559 | | |
2560 | 2560 | | |
2561 | 2561 | | |
2562 | | - | |
| 2562 | + | |
2563 | 2563 | | |
2564 | | - | |
| 2564 | + | |
2565 | 2565 | | |
2566 | 2566 | | |
2567 | 2567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
71 | 81 | | |
72 | 82 | | |
73 | 83 | | |
| |||
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 18 | + | |
28 | 19 | | |
29 | 20 | | |
30 | 21 | | |
| |||
93 | 84 | | |
94 | 85 | | |
95 | 86 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
941 | 941 | | |
942 | 942 | | |
943 | 943 | | |
944 | | - | |
| 944 | + | |
945 | 945 | | |
946 | 946 | | |
947 | 947 | | |
| |||
2748 | 2748 | | |
2749 | 2749 | | |
2750 | 2750 | | |
2751 | | - | |
2752 | | - | |
2753 | 2751 | | |
2754 | 2752 | | |
2755 | 2753 | | |
| |||
2786 | 2784 | | |
2787 | 2785 | | |
2788 | 2786 | | |
| 2787 | + | |
2789 | 2788 | | |
2790 | 2789 | | |
2791 | 2790 | | |
| |||
3129 | 3128 | | |
3130 | 3129 | | |
3131 | 3130 | | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
3132 | 3139 | | |
3133 | 3140 | | |
3134 | 3141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
| 799 | + | |
799 | 800 | | |
800 | 801 | | |
801 | 802 | | |
| |||
0 commit comments