@@ -139,6 +139,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
139
139
& Attribute :: Parsed ( AttributeKind :: TypeConst ( attr_span) ) => {
140
140
self . check_type_const ( hir_id, attr_span, target)
141
141
}
142
+ & Attribute :: Parsed ( AttributeKind :: Marker ( attr_span) ) => {
143
+ self . check_marker ( hir_id, attr_span, span, target)
144
+ }
142
145
Attribute :: Parsed ( AttributeKind :: Confusables { first_span, .. } ) => {
143
146
self . check_confusables ( * first_span, target) ;
144
147
}
@@ -272,7 +275,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
272
275
[ sym:: no_sanitize, ..] => {
273
276
self . check_no_sanitize ( attr, span, target)
274
277
}
275
- [ sym:: marker, ..] => self . check_marker ( hir_id, attr, span, target) ,
276
278
[ sym:: thread_local, ..] => self . check_thread_local ( attr, span, target) ,
277
279
[ sym:: doc, ..] => self . check_doc_attrs (
278
280
attr,
@@ -836,21 +838,19 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
836
838
}
837
839
838
840
/// Checks if the `#[marker]` attribute on an `item` is valid.
839
- fn check_marker ( & self , hir_id : HirId , attr : & Attribute , span : Span , target : Target ) {
841
+ fn check_marker ( & self , hir_id : HirId , attr_span : Span , span : Span , target : Target ) {
840
842
match target {
841
843
Target :: Trait => { }
842
844
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
843
845
// `#[marker]` attribute with just a lint, because we previously
844
846
// erroneously allowed it and some crates used it accidentally, to be compatible
845
847
// with crates depending on them, we can't throw an error here.
846
848
Target :: Field | Target :: Arm | Target :: MacroDef => {
847
- self . inline_attr_str_error_with_macro_def ( hir_id, attr . span ( ) , "marker" ) ;
849
+ self . inline_attr_str_error_with_macro_def ( hir_id, attr_span , "marker" ) ;
848
850
}
849
851
_ => {
850
- self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToTrait {
851
- attr_span : attr. span ( ) ,
852
- defn_span : span,
853
- } ) ;
852
+ self . dcx ( )
853
+ . emit_err ( errors:: AttrShouldBeAppliedToTrait { attr_span, defn_span : span } ) ;
854
854
}
855
855
}
856
856
}
0 commit comments