@@ -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
@@ -204,7 +207,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
204207 [ sym:: rustc_std_internal_symbol, ..] => {
205208 self . check_rustc_std_internal_symbol ( attr, span, target)
206209 }
207- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
208210 [ sym:: rustc_no_implicit_autorefs, ..] => {
209211 self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
210212 }
@@ -613,7 +615,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
613615 fn check_naked (
614616 & self ,
615617 hir_id : HirId ,
616- attr : & Attribute ,
618+ attr_span : Span ,
617619 span : Span ,
618620 target : Target ,
619621 attrs : & [ Attribute ] ,
@@ -649,7 +651,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
649651 sym:: link_section,
650652 sym:: linkage,
651653 sym:: no_mangle,
652- sym:: naked,
653654 sym:: instruction_set,
654655 sym:: repr,
655656 sym:: align,
@@ -690,14 +691,15 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
690691 AttributeKind :: Deprecation { .. }
691692 | AttributeKind :: Repr { .. }
692693 | AttributeKind :: Align { .. }
693- | AttributeKind :: Cold ( ..) ,
694+ | AttributeKind :: Cold ( ..)
695+ | AttributeKind :: Naked ( ..) ,
694696 ) => {
695697 continue ;
696698 }
697699 Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
698700 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
699701 span : * span,
700- naked_span : attr . span ( ) ,
702+ naked_span : attr_span ,
701703 attr : sym:: inline. to_string ( ) ,
702704 } ) ;
703705
@@ -734,7 +736,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
734736
735737 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
736738 span : other_attr. span ( ) ,
737- naked_span : attr . span ( ) ,
739+ naked_span : attr_span ,
738740 attr : other_attr_name,
739741 } ) ;
740742
@@ -744,7 +746,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
744746 }
745747 _ => {
746748 self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
747- attr_span : attr . span ( ) ,
749+ attr_span,
748750 defn_span : span,
749751 on_crate : hir_id == CRATE_HIR_ID ,
750752 } ) ;
0 commit comments