1
Fork 0

split up #[rustc_deny_explicit_impl] attribute

This commit splits the `#[rustc_deny_explicit_impl(implement_via_object = ...)]` attribute
into two attributes `#[rustc_deny_explicit_impl]` and `#[rustc_do_not_implement_via_object]`.

This allows us to have special traits that can have user-defined impls but do not have the
automatic trait impl for trait objects (`impl Trait for dyn Trait`).
This commit is contained in:
Lukas Markeffsky 2024-12-20 16:57:14 +01:00
parent 8a1f8039a7
commit 42c00cb647
13 changed files with 152 additions and 91 deletions

View file

@ -186,6 +186,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
[sym::rustc_coinductive, ..]
| [sym::rustc_must_implement_one_of, ..]
| [sym::rustc_deny_explicit_impl, ..]
| [sym::rustc_do_not_implement_via_object, ..]
| [sym::const_trait, ..] => self.check_must_be_applied_to_trait(attr, span, target),
[sym::collapse_debuginfo, ..] => self.check_collapse_debuginfo(attr, span, target),
[sym::must_not_suspend, ..] => self.check_must_not_suspend(attr, span, target),