@@ -160,6 +160,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
160
160
Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
161
161
self . check_align ( span, target, * align, * repr_span)
162
162
}
163
+ Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
164
+ self . check_naked ( hir_id, * attr_span, span, target, attrs)
165
+ }
163
166
Attribute :: Parsed (
164
167
AttributeKind :: BodyStability { .. }
165
168
| AttributeKind :: ConstStabilityIndirect
@@ -214,7 +217,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
214
217
[ sym:: rustc_std_internal_symbol, ..] => {
215
218
self . check_rustc_std_internal_symbol ( attr, span, target)
216
219
}
217
- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
218
220
[ sym:: rustc_no_implicit_autorefs, ..] => {
219
221
self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
220
222
}
@@ -621,7 +623,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
621
623
fn check_naked (
622
624
& self ,
623
625
hir_id : HirId ,
624
- attr : & Attribute ,
626
+ attr_span : Span ,
625
627
span : Span ,
626
628
target : Target ,
627
629
attrs : & [ Attribute ] ,
@@ -657,7 +659,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
657
659
sym:: link_section,
658
660
sym:: linkage,
659
661
sym:: no_mangle,
660
- sym:: naked,
661
662
sym:: instruction_set,
662
663
sym:: repr,
663
664
sym:: align,
@@ -700,13 +701,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
700
701
| AttributeKind :: Align { .. }
701
702
| AttributeKind :: Cold ( ..)
702
703
| AttributeKind :: MustUse { .. } ,
704
+ | AttributeKind :: Naked ( ..) ,
703
705
) => {
704
706
continue ;
705
707
}
706
708
Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
707
709
self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
708
710
span : * span,
709
- naked_span : attr . span ( ) ,
711
+ naked_span : attr_span ,
710
712
attr : sym:: inline. to_string ( ) ,
711
713
} ) ;
712
714
@@ -743,7 +745,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
743
745
744
746
self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
745
747
span : other_attr. span ( ) ,
746
- naked_span : attr . span ( ) ,
748
+ naked_span : attr_span ,
747
749
attr : other_attr_name,
748
750
} ) ;
749
751
@@ -753,7 +755,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
753
755
}
754
756
_ => {
755
757
self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
756
- attr_span : attr . span ( ) ,
758
+ attr_span,
757
759
defn_span : span,
758
760
on_crate : hir_id == CRATE_HIR_ID ,
759
761
} ) ;
0 commit comments