@@ -139,6 +139,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
139139 & Attribute :: Parsed ( AttributeKind :: TypeConst ( attr_span) ) => {
140140 self . check_type_const ( hir_id, attr_span, target)
141141 }
142+ & Attribute :: Parsed ( AttributeKind :: Marker ( attr_span) ) => {
143+ self . check_marker ( hir_id, attr_span, span, target)
144+ }
142145 Attribute :: Parsed ( AttributeKind :: Confusables { first_span, .. } ) => {
143146 self . check_confusables ( * first_span, target) ;
144147 }
@@ -259,7 +262,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
259262 [ sym:: no_sanitize, ..] => {
260263 self . check_no_sanitize ( attr, span, target)
261264 }
262- [ sym:: marker, ..] => self . check_marker ( hir_id, attr, span, target) ,
263265 [ sym:: thread_local, ..] => self . check_thread_local ( attr, span, target) ,
264266 [ sym:: doc, ..] => self . check_doc_attrs (
265267 attr,
@@ -829,21 +831,19 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
829831 }
830832
831833 /// Checks if the `#[marker]` attribute on an `item` is valid.
832- fn check_marker ( & self , hir_id : HirId , attr : & Attribute , span : Span , target : Target ) {
834+ fn check_marker ( & self , hir_id : HirId , attr_span : Span , span : Span , target : Target ) {
833835 match target {
834836 Target :: Trait => { }
835837 // FIXME(#80564): We permit struct fields, match arms and macro defs to have an
836838 // `#[marker]` attribute with just a lint, because we previously
837839 // erroneously allowed it and some crates used it accidentally, to be compatible
838840 // with crates depending on them, we can't throw an error here.
839841 Target :: Field | Target :: Arm | Target :: MacroDef => {
840- self . inline_attr_str_error_with_macro_def ( hir_id, attr . span ( ) , "marker" ) ;
842+ self . inline_attr_str_error_with_macro_def ( hir_id, attr_span , "marker" ) ;
841843 }
842844 _ => {
843- self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToTrait {
844- attr_span : attr. span ( ) ,
845- defn_span : span,
846- } ) ;
845+ self . dcx ( )
846+ . emit_err ( errors:: AttrShouldBeAppliedToTrait { attr_span, defn_span : span } ) ;
847847 }
848848 }
849849 }
0 commit comments