@@ -160,6 +160,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
160160 Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
161161 self . check_align ( span, target, * align, * repr_span)
162162 }
163+ Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
164+ self . check_naked ( hir_id, * attr_span, span, target, attrs)
165+ }
163166 Attribute :: Parsed (
164167 AttributeKind :: BodyStability { .. }
165168 | AttributeKind :: ConstStabilityIndirect
@@ -217,7 +220,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
217220 [ sym:: rustc_std_internal_symbol, ..] => {
218221 self . check_rustc_std_internal_symbol ( attr, span, target)
219222 }
220- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
221223 [ sym:: rustc_no_implicit_autorefs, ..] => {
222224 self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
223225 }
@@ -623,7 +625,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
623625 fn check_naked (
624626 & self ,
625627 hir_id : HirId ,
626- attr : & Attribute ,
628+ attr_span : Span ,
627629 span : Span ,
628630 target : Target ,
629631 attrs : & [ Attribute ] ,
@@ -659,7 +661,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
659661 sym:: link_section,
660662 sym:: linkage,
661663 sym:: no_mangle,
662- sym:: naked,
663664 sym:: instruction_set,
664665 sym:: repr,
665666 sym:: align,
@@ -703,13 +704,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
703704 | AttributeKind :: NoMangle ( ..)
704705 | AttributeKind :: Cold ( ..)
705706 | AttributeKind :: MustUse { .. } ,
707+ | AttributeKind :: Naked ( ..) ,
706708 ) => {
707709 continue ;
708710 }
709711 Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
710712 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
711713 span : * span,
712- naked_span : attr . span ( ) ,
714+ naked_span : attr_span ,
713715 attr : sym:: inline. to_string ( ) ,
714716 } ) ;
715717
@@ -746,7 +748,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
746748
747749 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
748750 span : other_attr. span ( ) ,
749- naked_span : attr . span ( ) ,
751+ naked_span : attr_span ,
750752 attr : other_attr_name,
751753 } ) ;
752754
@@ -756,7 +758,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
756758 }
757759 _ => {
758760 self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
759- attr_span : attr . span ( ) ,
761+ attr_span,
760762 defn_span : span,
761763 on_crate : hir_id == CRATE_HIR_ID ,
762764 } ) ;
0 commit comments