@@ -155,6 +155,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
155155 Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
156156 self . check_align ( span, target, * align, * repr_span)
157157 }
158+ Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
159+ self . check_naked ( hir_id, * attr_span, span, target, attrs)
160+ }
158161 Attribute :: Parsed (
159162 AttributeKind :: BodyStability { .. }
160163 | AttributeKind :: ConstStabilityIndirect
@@ -201,7 +204,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
201204 [ sym:: rustc_std_internal_symbol, ..] => {
202205 self . check_rustc_std_internal_symbol ( attr, span, target)
203206 }
204- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
205207 [ sym:: rustc_no_implicit_autorefs, ..] => {
206208 self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
207209 }
@@ -611,7 +613,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
611613 fn check_naked (
612614 & self ,
613615 hir_id : HirId ,
614- attr : & Attribute ,
616+ attr_span : Span ,
615617 span : Span ,
616618 target : Target ,
617619 attrs : & [ Attribute ] ,
@@ -647,7 +649,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
647649 sym:: link_section,
648650 sym:: linkage,
649651 sym:: no_mangle,
650- sym:: naked,
651652 sym:: instruction_set,
652653 sym:: repr,
653654 sym:: align,
@@ -688,14 +689,15 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
688689 AttributeKind :: Deprecation { .. }
689690 | AttributeKind :: Repr { .. }
690691 | AttributeKind :: Align { .. }
691- | AttributeKind :: Cold ( ..) ,
692+ | AttributeKind :: Cold ( ..)
693+ | AttributeKind :: Naked ( ..) ,
692694 ) => {
693695 continue ;
694696 }
695697 Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
696698 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
697699 span : * span,
698- naked_span : attr . span ( ) ,
700+ naked_span : attr_span ,
699701 attr : sym:: inline. to_string ( ) ,
700702 } ) ;
701703
@@ -729,7 +731,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
729731
730732 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
731733 span : other_attr. span ( ) ,
732- naked_span : attr . span ( ) ,
734+ naked_span : attr_span ,
733735 attr : other_attr_name,
734736 } ) ;
735737
@@ -739,7 +741,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
739741 }
740742 _ => {
741743 self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
742- attr_span : attr . span ( ) ,
744+ attr_span,
743745 defn_span : span,
744746 on_crate : hir_id == CRATE_HIR_ID ,
745747 } ) ;
0 commit comments