@@ -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 }
@@ -251,7 +254,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
251254 self . check_no_sanitize ( attr, span, target)
252255 }
253256 [ sym:: non_exhaustive, ..] => self . check_non_exhaustive ( hir_id, attr, span, target, item) ,
254- [ sym:: marker, ..] => self . check_marker ( hir_id, attr, span, target) ,
255257 [ sym:: thread_local, ..] => self . check_thread_local ( attr, span, target) ,
256258 [ sym:: doc, ..] => self . check_doc_attrs (
257259 attr,
@@ -823,21 +825,19 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
823825 }
824826
825827 /// Checks if the `#[marker]` attribute on an `item` is valid.
826- fn check_marker ( & self , hir_id : HirId , attr : & Attribute , span : Span , target : Target ) {
828+ fn check_marker ( & self , hir_id : HirId , attr_span : Span , span : Span , target : Target ) {
827829 match target {
828830 Target :: Trait => { }
829831 // FIXME(#80564): We permit struct fields, match arms and macro defs to have an
830832 // `#[marker]` attribute with just a lint, because we previously
831833 // erroneously allowed it and some crates used it accidentally, to be compatible
832834 // with crates depending on them, we can't throw an error here.
833835 Target :: Field | Target :: Arm | Target :: MacroDef => {
834- self . inline_attr_str_error_with_macro_def ( hir_id, attr . span ( ) , "marker" ) ;
836+ self . inline_attr_str_error_with_macro_def ( hir_id, attr_span , "marker" ) ;
835837 }
836838 _ => {
837- self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToTrait {
838- attr_span : attr. span ( ) ,
839- defn_span : span,
840- } ) ;
839+ self . dcx ( )
840+ . emit_err ( errors:: AttrShouldBeAppliedToTrait { attr_span, defn_span : span } ) ;
841841 }
842842 }
843843 }
0 commit comments