Commit 8c4e417
Rollup merge of rust-lang#134573 - lukas-code:unimpl-dyn-pointerlike, r=compiler-errors
unimplement `PointerLike` for trait objects
Values of type `dyn* PointerLike` or `dyn PointerLike` are not pointer-like so these types should not implement `PointerLike`.
After rust-lang#133226, `PointerLike` allows user implementations, so we can't just mark it with `#[rustc_deny_explicit_impl(implement_via_object = false)]`. Instead, this PR splits the `#[rustc_deny_explicit_impl(implement_via_object = ...)]` attribute into two separate attributes `#[rustc_deny_explicit_impl]` and `#[rustc_do_not_implement_via_object]` so that we opt out of the automatic `impl PointerLike for dyn PointerLike` and still allow user implementations.
For traits that are marked with `#[do_not_implement_via_object]` but not `#[rustc_deny_explicit_impl]` I've also made it possible to add a manual `impl Trait for dyn Trait`. There is no immediate need for this, but it was one line to implement and seems nice to have.
fixes rust-lang#134545
fixes rust-lang#134543
r? `@compiler-errors`File tree
4 files changed
+30
-11
lines changed- core/src
- future
- mem
- ptr
4 files changed
+30
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
| |||
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
184 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
| |||
815 | 819 | | |
816 | 820 | | |
817 | 821 | | |
818 | | - | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
819 | 825 | | |
820 | 826 | | |
821 | 827 | | |
| |||
956 | 962 | | |
957 | 963 | | |
958 | 964 | | |
959 | | - | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
960 | 968 | | |
961 | 969 | | |
962 | 970 | | |
| |||
967 | 975 | | |
968 | 976 | | |
969 | 977 | | |
970 | | - | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
971 | 981 | | |
972 | 982 | | |
973 | 983 | | |
974 | 984 | | |
975 | | - | |
976 | | - | |
| 985 | + | |
| 986 | + | |
977 | 987 | | |
978 | 988 | | |
979 | 989 | | |
980 | 990 | | |
981 | 991 | | |
982 | 992 | | |
| 993 | + | |
983 | 994 | | |
984 | 995 | | |
985 | 996 | | |
| |||
1068 | 1079 | | |
1069 | 1080 | | |
1070 | 1081 | | |
1071 | | - | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
1072 | 1085 | | |
1073 | 1086 | | |
1074 | 1087 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
0 commit comments