@@ -160,6 +160,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
160
160
Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
161
161
self . check_align ( span, target, * align, * repr_span)
162
162
}
163
+ Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
164
+ self . check_naked ( hir_id, * attr_span, span, target, attrs)
165
+ }
163
166
Attribute :: Parsed (
164
167
AttributeKind :: BodyStability { .. }
165
168
| AttributeKind :: ConstStabilityIndirect
@@ -217,7 +220,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
217
220
[ sym:: rustc_std_internal_symbol, ..] => {
218
221
self . check_rustc_std_internal_symbol ( attr, span, target)
219
222
}
220
- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
221
223
[ sym:: rustc_no_implicit_autorefs, ..] => {
222
224
self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
223
225
}
@@ -623,7 +625,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
623
625
fn check_naked (
624
626
& self ,
625
627
hir_id : HirId ,
626
- attr : & Attribute ,
628
+ attr_span : Span ,
627
629
span : Span ,
628
630
target : Target ,
629
631
attrs : & [ Attribute ] ,
@@ -659,7 +661,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
659
661
sym:: link_section,
660
662
sym:: linkage,
661
663
sym:: no_mangle,
662
- sym:: naked,
663
664
sym:: instruction_set,
664
665
sym:: repr,
665
666
sym:: align,
@@ -703,13 +704,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
703
704
| AttributeKind :: NoMangle ( ..)
704
705
| AttributeKind :: Cold ( ..)
705
706
| AttributeKind :: MustUse { .. } ,
707
+ | AttributeKind :: Naked ( ..) ,
706
708
) => {
707
709
continue ;
708
710
}
709
711
Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
710
712
self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
711
713
span : * span,
712
- naked_span : attr . span ( ) ,
714
+ naked_span : attr_span ,
713
715
attr : sym:: inline. to_string ( ) ,
714
716
} ) ;
715
717
@@ -746,7 +748,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
746
748
747
749
self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
748
750
span : other_attr. span ( ) ,
749
- naked_span : attr . span ( ) ,
751
+ naked_span : attr_span ,
750
752
attr : other_attr_name,
751
753
} ) ;
752
754
@@ -756,7 +758,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
756
758
}
757
759
_ => {
758
760
self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
759
- attr_span : attr . span ( ) ,
761
+ attr_span,
760
762
defn_span : span,
761
763
on_crate : hir_id == CRATE_HIR_ID ,
762
764
} ) ;
0 commit comments