@@ -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
}
@@ -251,7 +254,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
251
254
self . check_no_sanitize ( attr, span, target)
252
255
}
253
256
[ sym:: non_exhaustive, ..] => self . check_non_exhaustive ( hir_id, attr, span, target, item) ,
254
- [ sym:: marker, ..] => self . check_marker ( hir_id, attr, span, target) ,
255
257
[ sym:: thread_local, ..] => self . check_thread_local ( attr, span, target) ,
256
258
[ sym:: doc, ..] => self . check_doc_attrs (
257
259
attr,
@@ -823,21 +825,19 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
823
825
}
824
826
825
827
/// 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 ) {
827
829
match target {
828
830
Target :: Trait => { }
829
831
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
830
832
// `#[marker]` attribute with just a lint, because we previously
831
833
// erroneously allowed it and some crates used it accidentally, to be compatible
832
834
// with crates depending on them, we can't throw an error here.
833
835
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" ) ;
835
837
}
836
838
_ => {
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 } ) ;
841
841
}
842
842
}
843
843
}
0 commit comments