@@ -155,6 +155,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
155
155
Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
156
156
self . check_align ( span, target, * align, * repr_span)
157
157
}
158
+ Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
159
+ self . check_naked ( hir_id, * attr_span, span, target, attrs)
160
+ }
158
161
Attribute :: Parsed (
159
162
AttributeKind :: BodyStability { .. }
160
163
| AttributeKind :: ConstStabilityIndirect
@@ -201,7 +204,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
201
204
[ sym:: rustc_std_internal_symbol, ..] => {
202
205
self . check_rustc_std_internal_symbol ( attr, span, target)
203
206
}
204
- [ sym:: naked, ..] => self . check_naked ( hir_id, attr, span, target, attrs) ,
205
207
[ sym:: rustc_no_implicit_autorefs, ..] => {
206
208
self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
207
209
}
@@ -611,7 +613,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
611
613
fn check_naked (
612
614
& self ,
613
615
hir_id : HirId ,
614
- attr : & Attribute ,
616
+ attr_span : Span ,
615
617
span : Span ,
616
618
target : Target ,
617
619
attrs : & [ Attribute ] ,
@@ -647,7 +649,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
647
649
sym:: link_section,
648
650
sym:: linkage,
649
651
sym:: no_mangle,
650
- sym:: naked,
651
652
sym:: instruction_set,
652
653
sym:: repr,
653
654
sym:: align,
@@ -688,14 +689,15 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
688
689
AttributeKind :: Deprecation { .. }
689
690
| AttributeKind :: Repr { .. }
690
691
| AttributeKind :: Align { .. }
691
- | AttributeKind :: Cold ( ..) ,
692
+ | AttributeKind :: Cold ( ..)
693
+ | AttributeKind :: Naked ( ..) ,
692
694
) => {
693
695
continue ;
694
696
}
695
697
Attribute :: Parsed ( AttributeKind :: Inline ( .., span) ) => {
696
698
self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
697
699
span : * span,
698
- naked_span : attr . span ( ) ,
700
+ naked_span : attr_span ,
699
701
attr : sym:: inline. to_string ( ) ,
700
702
} ) ;
701
703
@@ -729,7 +731,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
729
731
730
732
self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
731
733
span : other_attr. span ( ) ,
732
- naked_span : attr . span ( ) ,
734
+ naked_span : attr_span ,
733
735
attr : other_attr_name,
734
736
} ) ;
735
737
@@ -739,7 +741,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
739
741
}
740
742
_ => {
741
743
self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
742
- attr_span : attr . span ( ) ,
744
+ attr_span,
743
745
defn_span : span,
744
746
on_crate : hir_id == CRATE_HIR_ID ,
745
747
} ) ;
0 commit comments