1
Fork 0
rust/compiler/rustc_middle/src
Matthias Krüger 0b1834d66b
Rollup merge of #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 https://github.com/rust-lang/rust/pull/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 https://github.com/rust-lang/rust/issues/134545
fixes https://github.com/rust-lang/rust/issues/134543

r? `@compiler-errors`
2024-12-20 21:32:33 +01:00
..
dep_graph Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
hir Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
hooks Move some code from Compiler::enter to GlobalCtxt::finish 2024-11-09 17:55:39 +00:00
infer Remove associated type based effects logic 2024-10-24 09:46:36 +00:00
middle Make DependencyList an IndexVec 2024-12-19 15:30:32 +00:00
mir Rollup merge of #134497 - Zalathar:spans, r=jieyouxu 2024-12-19 15:26:16 +01:00
query Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
thir Introduce default_field_values feature 2024-12-09 21:55:01 +00:00
traits Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
ty split up #[rustc_deny_explicit_impl] attribute 2024-12-20 16:57:14 +01:00
util Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
arena.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
error.rs Move some code from Compiler::enter to GlobalCtxt::finish 2024-11-09 17:55:39 +00:00
lib.rs move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
lint.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
macros.rs Improve const traits diagnostics for new desugaring 2024-10-02 19:45:17 +08:00
metadata.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tests.rs Give an item related to issue 27438 a more meaningful name 2024-04-30 22:27:19 +02:00
thir.rs Introduce default_field_values feature 2024-12-09 21:55:01 +00:00
values.rs Rename ty_def_id so people will stop using it by accident 2024-12-13 16:36:38 +00:00