@@ -152,6 +152,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
152152 Attribute :: Parsed ( AttributeKind :: Cold ( attr_span) ) => {
153153 self . check_cold ( hir_id, * attr_span, span, target)
154154 }
155+ Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
156+ self . check_naked ( hir_id, * attr_span, span, target, attrs)
157+ }
155158 Attribute :: Parsed (
156159 AttributeKind :: BodyStability { .. }
157160 | AttributeKind :: ConstStabilityIndirect
@@ -198,7 +201,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
198201 [ sym:: rustc_std_internal_symbol, ..] => {
199202 self . check_rustc_std_internal_symbol ( attr, span, target)
200203 }
201- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
202204 [ sym:: rustc_no_implicit_autorefs, ..] => {
203205 self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
204206 }
@@ -608,7 +610,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
608610 fn check_naked (
609611 & self ,
610612 hir_id : HirId ,
611- attr : & Attribute ,
613+ attr_span : Span ,
612614 span : Span ,
613615 target : Target ,
614616 attrs : & [ Attribute ] ,
@@ -644,7 +646,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
644646 sym:: link_section,
645647 sym:: linkage,
646648 sym:: no_mangle,
647- sym:: naked,
648649 sym:: instruction_set,
649650 sym:: repr,
650651 sym:: rustc_std_internal_symbol,
@@ -683,14 +684,15 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
683684 Attribute :: Parsed (
684685 AttributeKind :: Deprecation { .. }
685686 | AttributeKind :: Repr { .. }
686- | AttributeKind :: Cold ( ..) ,
687+ | AttributeKind :: Cold ( ..)
688+ | AttributeKind :: Naked ( ..) ,
687689 ) => {
688690 continue ;
689691 }
690692 Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
691693 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
692694 span : * span,
693- naked_span : attr . span ( ) ,
695+ naked_span : attr_span ,
694696 attr : sym:: inline. to_string ( ) ,
695697 } ) ;
696698
@@ -724,7 +726,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
724726
725727 self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
726728 span : other_attr. span ( ) ,
727- naked_span : attr . span ( ) ,
729+ naked_span : attr_span ,
728730 attr : other_attr_name,
729731 } ) ;
730732
@@ -734,7 +736,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
734736 }
735737 _ => {
736738 self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
737- attr_span : attr . span ( ) ,
739+ attr_span,
738740 defn_span : span,
739741 on_crate : hir_id == CRATE_HIR_ID ,
740742 } ) ;
0 commit comments