@@ -110,9 +110,6 @@ impl CheckAttrVisitor<'_> {
110
110
sym:: no_coverage => self . check_no_coverage ( hir_id, attr, span, target) ,
111
111
sym:: non_exhaustive => self . check_non_exhaustive ( hir_id, attr, span, target) ,
112
112
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
- }
116
113
sym:: target_feature => self . check_target_feature ( hir_id, attr, span, target) ,
117
114
sym:: thread_local => self . check_thread_local ( attr, span, target) ,
118
115
sym:: track_caller => {
@@ -159,12 +156,14 @@ impl CheckAttrVisitor<'_> {
159
156
| sym:: rustc_dirty
160
157
| sym:: rustc_if_this_changed
161
158
| 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) ,
163
163
sym:: cmse_nonsecure_entry => {
164
164
self . check_cmse_nonsecure_entry ( hir_id, attr, span, target)
165
165
}
166
166
sym:: collapse_debuginfo => self . check_collapse_debuginfo ( attr, span, target) ,
167
- sym:: const_trait => self . check_const_trait ( attr, span, target) ,
168
167
sym:: must_not_suspend => self . check_must_not_suspend ( & attr, span, target) ,
169
168
sym:: must_use => self . check_must_use ( hir_id, & attr, target) ,
170
169
sym:: rustc_pass_by_value => self . check_pass_by_value ( & attr, span, target) ,
@@ -567,25 +566,6 @@ impl CheckAttrVisitor<'_> {
567
566
}
568
567
}
569
568
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
-
589
569
/// Checks if the `#[target_feature]` attribute on `item` is valid. Returns `true` if valid.
590
570
fn check_target_feature (
591
571
& self ,
@@ -1591,8 +1571,8 @@ impl CheckAttrVisitor<'_> {
1591
1571
}
1592
1572
}
1593
1573
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 {
1596
1576
match target {
1597
1577
Target :: Trait => true ,
1598
1578
_ => {
@@ -1986,17 +1966,6 @@ impl CheckAttrVisitor<'_> {
1986
1966
}
1987
1967
}
1988
1968
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
-
2000
1969
fn check_stability_promotable ( & self , attr : & Attribute , _span : Span , target : Target ) -> bool {
2001
1970
match target {
2002
1971
Target :: Expression => {
0 commit comments