@@ -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
@@ -732,7 +734,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
732734
733735 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
734736 span : other_attr. span ( ) ,
735- naked_span : attr . span ( ) ,
737+ naked_span : attr_span ,
736738 attr : other_attr_name,
737739 } ) ;
738740
@@ -742,7 +744,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
742744 }
743745 _ => {
744746 self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
745- attr_span : attr . span ( ) ,
747+ attr_span,
746748 defn_span : span,
747749 on_crate : hir_id == CRATE_HIR_ID ,
748750 } ) ;
0 commit comments