-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit d3df8ff
Auto merge of #120780 - fmease:lta-in-impls, r=oli-obk
Properly deal with weak alias types as self types of impls
Fixes #114216.
Fixes #116100.
Not super happy about the two ad hoc "normalization" implementations for weak alias types:
1. In `inherent_impls`: The "peeling", normalization to ["WHNF"][whnf]: Semantically that's exactly what we want (neither proper normalization nor shallow normalization would be correct here). Basically a weak alias type is "nominal" (well...^^) if the WHNF is nominal. [#97974](#97974) followed the same approach.
2. In `constrained_generic_params`: Generic parameters are constrained by a weak alias type if the corresp. "normalized" type constrains them (where we only normalize *weak* alias types not arbitrary ones). Weak alias types are injective if the corresp. "normalized" type is injective.
Both have ad hoc overflow detection mechanisms.
**Coherence** is handled in #117164.
r? `@oli-obk` or types
[whnf]: https://en.wikipedia.org/wiki/Lambda_calculus_definition#Weak_head_normal_form File tree
18 files changed
+298
-18
lines changed- compiler/rustc_hir_analysis/src
- coherence
- collect
- impl_wf_check
- tests/ui/lazy-type-alias
18 files changed
+298
-18
lines changedLines changed: 30 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
147 | + | ||
147 | 148 |
| |
148 | 149 |
| |
149 | 150 |
| |
| |||
166 | 167 |
| |
167 | 168 |
| |
168 | 169 |
| |
169 | - | ||
170 | + | ||
170 | 171 |
| |
171 | 172 |
| |
172 | 173 |
| |
173 | 174 |
| |
174 | 175 |
| |
175 | 176 |
| |
176 | 177 |
| |
178 | + | ||
177 | 179 |
| |
178 | 180 |
| |
179 | 181 |
| |
| |||
184 | 186 |
| |
185 | 187 |
| |
186 | 188 |
| |
189 | + | ||
190 | + | ||
191 | + | ||
192 | + | ||
193 | + | ||
194 | + | ||
195 | + | ||
196 | + | ||
197 | + | ||
198 | + | ||
199 | + | ||
200 | + | ||
201 | + | ||
202 | + | ||
203 | + | ||
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | ||
215 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
307 | 307 |
| |
308 | 308 |
| |
309 | 309 |
| |
310 | - | ||
310 | + | ||
311 | 311 |
| |
312 | 312 |
| |
313 | 313 |
| |
|
Lines changed: 33 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | + | ||
2 | 3 |
| |
3 | 4 |
| |
4 | 5 |
| |
| |||
27 | 28 |
| |
28 | 29 |
| |
29 | 30 |
| |
31 | + | ||
30 | 32 |
| |
31 | 33 |
| |
32 | 34 |
| |
33 | 35 |
| |
34 | - | ||
35 | - | ||
36 | + | ||
37 | + | ||
36 | 38 |
| |
37 | 39 |
| |
38 | 40 |
| |
| |||
43 | 45 |
| |
44 | 46 |
| |
45 | 47 |
| |
48 | + | ||
46 | 49 |
| |
47 | 50 |
| |
48 | 51 |
| |
49 | - | ||
52 | + | ||
53 | + | ||
50 | 54 |
| |
51 | 55 |
| |
52 | 56 |
| |
53 | 57 |
| |
54 | - | ||
58 | + | ||
59 | + | ||
55 | 60 |
| |
56 | 61 |
| |
62 | + | ||
57 | 63 |
| |
58 | 64 |
| |
59 | - | ||
65 | + | ||
60 | 66 |
| |
61 | 67 |
| |
62 | - | ||
63 | - | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
64 | 72 |
| |
65 | 73 |
| |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + | ||
66 | 89 |
| |
67 | 90 |
| |
68 | 91 |
| |
| |||
82 | 105 |
| |
83 | 106 |
| |
84 | 107 |
| |
85 | - | ||
108 | + | ||
86 | 109 |
| |
87 | 110 |
| |
88 | 111 |
| |
| |||
201 | 224 |
| |
202 | 225 |
| |
203 | 226 |
| |
204 | - | ||
227 | + | ||
205 | 228 |
| |
206 | 229 |
| |
207 | 230 |
| |
208 | 231 |
| |
209 | - | ||
232 | + | ||
210 | 233 |
| |
211 | 234 |
| |
212 | 235 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
97 | - | ||
97 | + | ||
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
| |||
111 | 111 |
| |
112 | 112 |
| |
113 | 113 |
| |
114 | - | ||
114 | + | ||
115 | 115 |
| |
116 | 116 |
| |
117 | 117 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
266 | 266 |
| |
267 | 267 |
| |
268 | 268 |
| |
269 | - | ||
269 | + | ||
270 | 270 |
| |
271 | - | ||
271 | + | ||
272 | 272 |
| |
273 | 273 |
| |
274 | 274 |
| |
275 | 275 |
| |
276 | 276 |
| |
277 | - | ||
277 | + | ||
278 | 278 |
| |
279 | 279 |
| |
280 | 280 |
| |
| |||
312 | 312 |
| |
313 | 313 |
| |
314 | 314 |
| |
315 | - | ||
315 | + | ||
316 | 316 |
| |
317 | 317 |
| |
318 | 318 |
| |
|
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 | + | ||
27 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + |
Lines changed: 11 additions & 0 deletions
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 | + |
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + |
0 commit comments