@@ -110,9 +110,6 @@ impl CheckAttrVisitor<'_> {
110110 sym:: no_coverage => self . check_no_coverage ( hir_id, attr, span, target) ,
111111 sym:: non_exhaustive => self . check_non_exhaustive ( hir_id, attr, span, target) ,
112112 sym:: marker => self . check_marker ( hir_id, attr, span, target) ,
113- sym:: rustc_must_implement_one_of => {
114- self . check_rustc_must_implement_one_of ( attr, span, target)
115- }
116113 sym:: target_feature => self . check_target_feature ( hir_id, attr, span, target) ,
117114 sym:: thread_local => self . check_thread_local ( attr, span, target) ,
118115 sym:: track_caller => {
@@ -159,12 +156,14 @@ impl CheckAttrVisitor<'_> {
159156 | sym:: rustc_dirty
160157 | sym:: rustc_if_this_changed
161158 | sym:: rustc_then_this_would_need => self . check_rustc_dirty_clean ( & attr) ,
162- sym:: rustc_coinductive => self . check_rustc_coinductive ( & attr, span, target) ,
159+ sym:: rustc_coinductive
160+ | sym:: rustc_must_implement_one_of
161+ | sym:: rustc_deny_explicit_impl
162+ | sym:: const_trait => self . check_must_be_applied_to_trait ( & attr, span, target) ,
163163 sym:: cmse_nonsecure_entry => {
164164 self . check_cmse_nonsecure_entry ( hir_id, attr, span, target)
165165 }
166166 sym:: collapse_debuginfo => self . check_collapse_debuginfo ( attr, span, target) ,
167- sym:: const_trait => self . check_const_trait ( attr, span, target) ,
168167 sym:: must_not_suspend => self . check_must_not_suspend ( & attr, span, target) ,
169168 sym:: must_use => self . check_must_use ( hir_id, & attr, target) ,
170169 sym:: rustc_pass_by_value => self . check_pass_by_value ( & attr, span, target) ,
@@ -567,25 +566,6 @@ impl CheckAttrVisitor<'_> {
567566 }
568567 }
569568
570- /// Checks if the `#[rustc_must_implement_one_of]` attribute on a `target` is valid. Returns `true` if valid.
571- fn check_rustc_must_implement_one_of (
572- & self ,
573- attr : & Attribute ,
574- span : Span ,
575- target : Target ,
576- ) -> bool {
577- match target {
578- Target :: Trait => true ,
579- _ => {
580- self . tcx . sess . emit_err ( errors:: AttrShouldBeAppliedToTrait {
581- attr_span : attr. span ,
582- defn_span : span,
583- } ) ;
584- false
585- }
586- }
587- }
588-
589569 /// Checks if the `#[target_feature]` attribute on `item` is valid. Returns `true` if valid.
590570 fn check_target_feature (
591571 & self ,
@@ -1591,8 +1571,8 @@ impl CheckAttrVisitor<'_> {
15911571 }
15921572 }
15931573
1594- /// Checks if the `#[rustc_coinductive]` attribute is applied to a trait.
1595- fn check_rustc_coinductive ( & self , attr : & Attribute , span : Span , target : Target ) -> bool {
1574+ /// Checks if the attribute is applied to a trait.
1575+ fn check_must_be_applied_to_trait ( & self , attr : & Attribute , span : Span , target : Target ) -> bool {
15961576 match target {
15971577 Target :: Trait => true ,
15981578 _ => {
@@ -1986,17 +1966,6 @@ impl CheckAttrVisitor<'_> {
19861966 }
19871967 }
19881968
1989- /// `#[const_trait]` only applies to traits.
1990- fn check_const_trait ( & self , attr : & Attribute , _span : Span , target : Target ) -> bool {
1991- match target {
1992- Target :: Trait => true ,
1993- _ => {
1994- self . tcx . sess . emit_err ( errors:: ConstTrait { attr_span : attr. span } ) ;
1995- false
1996- }
1997- }
1998- }
1999-
20001969 fn check_stability_promotable ( & self , attr : & Attribute , _span : Span , target : Target ) -> bool {
20011970 match target {
20021971 Target :: Expression => {
0 commit comments