forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit ae33b90
authored
Rollup merge of rust-lang#123101 - Bryanskiy:delegation-fixes-2, r=petrochenkov
Delegation: fix ICE on wrong `Self` instantiation
fixes rust-lang#119921
fixes rust-lang#119919
There is no way to instantiate `Self` param for caller in delegation item if
1. callee is a trait method && callee contains `Self` param
2. delegation item isn't an associative item
In general, we can consider `Self` param as independent type param in these cases:
```rust
trait Trait {
fn foo(_: Option<&Self>) {...}
}
reuse Trait::foo;
// will be desugared to:
fn foo<T: Trait>(x: Option<&T>) { Trait::foo(x) }
```
But this requires early bound parameters support. For now, I suggest banning such cases to avoid ICE's.
r? ``@petrochenkov``File tree
21 files changed
+236
-177
lines changed- compiler/rustc_hir_analysis/src/hir_ty_lowering
- tests/ui/delegation
21 files changed
+236
-177
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2212 | 2212 |
| |
2213 | 2213 |
| |
2214 | 2214 |
| |
2215 | + | ||
2216 | + | ||
2217 | + | ||
2218 | + | ||
2219 | + | ||
2220 | + | ||
2221 | + | ||
2222 | + | ||
2223 | + | ||
2224 | + | ||
2225 | + | ||
2215 | 2226 |
| |
2216 | 2227 |
| |
2217 | 2228 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | - | ||
2 | + | ||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
37 | - | ||
38 | - | ||
39 | - | ||
40 | - | ||
41 | - | ||
42 | - | ||
43 | - | ||
44 | - | ||
45 | 37 |
| |
46 | 38 |
| |
47 | 39 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 | - | ||
29 | - | ||
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | ||
34 | - | ||
35 | - | ||
36 | - | ||
37 | - | ||
38 | - | ||
39 | - | ||
40 | 28 |
| |
41 | 29 |
| |
42 | 30 |
| |
| |||
66 | 54 |
| |
67 | 55 |
| |
68 | 56 |
| |
69 | - | ||
70 | - | ||
71 | - | ||
72 | - | ||
73 | - | ||
74 | - | ||
75 | - | ||
76 | - | ||
77 | - | ||
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | ||
82 | - | ||
83 | - | ||
84 | - | ||
85 | - | ||
86 | - | ||
87 | - | ||
88 | - | ||
89 | - | ||
90 | 57 |
| |
91 | 58 |
| |
92 | 59 |
| |
| |||
96 | 63 |
| |
97 | 64 |
| |
98 | 65 |
| |
99 | - | ||
66 | + | ||
100 | 67 |
| |
101 | - | ||
68 | + | ||
102 | 69 |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | - | ||
2 | + | ||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
|
Lines changed: 1 addition & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
12 | - | ||
13 | - | ||
14 | - | ||
15 | - | ||
16 | - | ||
17 | - | ||
18 | - | ||
19 | - | ||
20 | - | ||
21 | - | ||
12 | + | ||
22 | 13 |
| |
23 | 14 |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 | - | ||
4 | + | ||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
|
Lines changed: 0 additions & 11 deletions
This file was deleted.
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 | - | ||
4 | + | ||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 | - | ||
14 | 13 |
| |
15 | 14 |
| |
16 | 15 |
| |
| |||
29 | 28 |
| |
30 | 29 |
| |
31 | 30 |
| |
32 | - | ||
33 | 31 |
| |
34 | 32 |
| |
35 | 33 |
| |
36 | - | ||
37 | 34 |
| |
38 | 35 |
| |
39 | 36 |
| |
| |||
49 | 46 |
| |
50 | 47 |
| |
51 | 48 |
| |
52 | - | ||
53 | - | ||
54 | 49 |
| |
55 | 50 |
| |
56 | - | ||
57 | - | ||
58 | 51 |
| |
59 | 52 |
| |
60 | - | ||
61 | - | ||
62 | - | ||
63 | - | ||
64 | 53 |
|
This file was deleted.
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 | - | ||
4 | + | ||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
|
0 commit comments