-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit 7e19eef
Auto merge of #140557 - compiler-errors:remove-wf-hack, r=lcnr
Remove manual WF hack
We do not need this hack anymore since we fixed the candidate selection problems with `Sized` bounds. We prefer built-in sized bounds now since #138176, which fixes the only regression this hack was intended to fix.
While this theoretically is broken for some code, for example, when there a param-env bound that shadows an impl or built-in trait, we don't see it in practice and IMO it's not worth the burden of having to maintain this wart in `compare_method_predicate_entailment`.
The code that regresses is, for example:
```rust
trait Bar<'a> {}
trait Foo<'a, T> {
fn method(&self)
where
Self: Bar<'a>;
}
struct W<'a, T>(&'a T)
where
Self: Bar<'a>;
impl<'a, 'b, T> Bar<'a> for W<'b, T> {}
impl<'a, 'b, T> Foo<'a, T> for W<'b, T> {
fn method(&self) {}
}
```
Specifically, I don't believe this is really going to be encountered in practice. For this to fail, there must be a where clause in the *trait method* that would shadow an impl or built-in (non-`Sized`) candidate in the trait, and this shadowing would need to be encountered when solving a nested WF goal from the impl self type.
See #108544 for the original regression. Crater run is clean!
r? lcnrFile tree
7 files changed
+89
-72
lines changed- compiler/rustc_hir_analysis/src/check
- tests
- incremental/const-generics/try_unify_abstract_const_regression_tests
- ui
- dropck
- layout
7 files changed
+89
-72
lines changedLines changed: 9 additions & 56 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 | - | ||
6 | + | ||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
| |||
356 | 356 |
| |
357 | 357 |
| |
358 | 358 |
| |
359 | - | ||
360 | - | ||
361 | - | ||
362 | - | ||
363 | - | ||
364 | - | ||
365 | - | ||
366 | - | ||
367 | - | ||
368 | - | ||
369 | - | ||
370 | - | ||
371 | - | ||
372 | - | ||
373 | - | ||
374 | - | ||
375 | - | ||
376 | - | ||
377 | - | ||
378 | - | ||
379 | - | ||
380 | - | ||
381 | - | ||
382 | - | ||
383 | - | ||
384 | - | ||
385 | - | ||
386 | - | ||
387 | - | ||
388 | - | ||
389 | - | ||
390 | - | ||
391 | - | ||
392 | - | ||
393 | - | ||
394 | - | ||
395 | - | ||
396 | - | ||
397 | - | ||
398 | - | ||
399 | - | ||
400 | - | ||
401 | - | ||
402 | - | ||
403 | - | ||
404 | - | ||
405 | - | ||
406 | - | ||
407 | - | ||
408 | - | ||
409 | - | ||
410 | - | ||
411 | - | ||
412 | - | ||
413 | - | ||
359 | + | ||
360 | + | ||
361 | + | ||
362 | + | ||
363 | + | ||
364 | + | ||
365 | + | ||
366 | + | ||
414 | 367 |
| |
415 | 368 |
| |
416 | 369 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 | - | ||
18 | + | ||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 | - | ||
23 | + | ||
24 | + | ||
25 | + | ||
24 | 26 |
| |
25 | 27 |
| |
26 | 28 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
17 | 33 |
| |
18 | 34 |
| |
19 | 35 |
| |
| |||
30 | 46 |
| |
31 | 47 |
| |
32 | 48 |
| |
33 | - | ||
49 | + | ||
34 | 50 |
| |
35 | 51 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | - | ||
2 | + | ||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
18 | - | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
19 | 35 |
| |
20 | 36 |
| |
21 | 37 |
| |
| |||
30 | 46 |
| |
31 | 47 |
| |
32 | 48 |
| |
33 | - | ||
49 | + | ||
34 | 50 |
| |
35 | 51 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
34 | + | ||
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
| |||
39 | 40 |
| |
40 | 41 |
| |
41 | 42 |
| |
43 | + | ||
42 | 44 |
| |
43 | 45 |
| |
44 | 46 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 | - | ||
33 | + | ||
34 | + | ||
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
| |||
43 | 44 |
| |
44 | 45 |
| |
45 | 46 |
| |
47 | + | ||
46 | 48 |
| |
47 | 49 |
| |
48 | 50 |
| |
|
Lines changed: 35 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
14 | 27 |
| |
15 | - | ||
28 | + | ||
16 | 29 |
| |
17 | 30 |
| |
18 | 31 |
| |
| |||
24 | 37 |
| |
25 | 38 |
| |
26 | 39 |
| |
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
27 | 53 |
| |
28 | 54 |
| |
29 | 55 |
| |
| |||
36 | 62 |
| |
37 | 63 |
| |
38 | 64 |
| |
39 | - | ||
65 | + | ||
40 | 66 |
| |
41 | 67 |
| |
42 | 68 |
| |
| |||
47 | 73 |
| |
48 | 74 |
| |
49 | 75 |
| |
50 | - | ||
76 | + | ||
51 | 77 |
| |
52 | - | ||
53 | - | ||
54 | - | ||
55 | - | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + | ||
56 | 82 |
| |
57 | 83 |
| |
58 | 84 |
| |
| |||
62 | 88 |
| |
63 | 89 |
| |
64 | 90 |
| |
65 | - | ||
91 | + | ||
66 | 92 |
| |
67 | 93 |
| |
68 | 94 |
| |
| |||
76 | 102 |
| |
77 | 103 |
| |
78 | 104 |
| |
79 | - | ||
105 | + | ||
80 | 106 |
| |
81 | 107 |
| |
82 | 108 |
|
0 commit comments