@@ -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
@@ -214,7 +217,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
214217 [ sym:: rustc_std_internal_symbol, ..] => {
215218 self . check_rustc_std_internal_symbol ( attr, span, target)
216219 }
217- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
218220 [ sym:: rustc_no_implicit_autorefs, ..] => {
219221 self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
220222 }
@@ -621,7 +623,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
621623 fn check_naked (
622624 & self ,
623625 hir_id : HirId ,
624- attr : & Attribute ,
626+ attr_span : Span ,
625627 span : Span ,
626628 target : Target ,
627629 attrs : & [ Attribute ] ,
@@ -657,7 +659,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
657659 sym:: link_section,
658660 sym:: linkage,
659661 sym:: no_mangle,
660- sym:: naked,
661662 sym:: instruction_set,
662663 sym:: repr,
663664 sym:: align,
@@ -700,13 +701,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
700701 | AttributeKind :: Align { .. }
701702 | AttributeKind :: Cold ( ..)
702703 | AttributeKind :: MustUse { .. } ,
704+ | AttributeKind :: Naked ( ..) ,
703705 ) => {
704706 continue ;
705707 }
706708 Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
707709 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
708710 span : * span,
709- naked_span : attr . span ( ) ,
711+ naked_span : attr_span ,
710712 attr : sym:: inline. to_string ( ) ,
711713 } ) ;
712714
@@ -743,7 +745,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
743745
744746 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
745747 span : other_attr. span ( ) ,
746- naked_span : attr . span ( ) ,
748+ naked_span : attr_span ,
747749 attr : other_attr_name,
748750 } ) ;
749751
@@ -753,7 +755,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
753755 }
754756 _ => {
755757 self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
756- attr_span : attr . span ( ) ,
758+ attr_span,
757759 defn_span : span,
758760 on_crate : hir_id == CRATE_HIR_ID ,
759761 } ) ;
0 commit comments