@@ -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
@@ -732,7 +734,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
732
734
733
735
self . dcx ( ) . emit_err ( errors:: NakedFunctionIncompatibleAttribute {
734
736
span : other_attr. span ( ) ,
735
- naked_span : attr . span ( ) ,
737
+ naked_span : attr_span ,
736
738
attr : other_attr_name,
737
739
} ) ;
738
740
@@ -742,7 +744,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
742
744
}
743
745
_ => {
744
746
self . dcx ( ) . emit_err ( errors:: AttrShouldBeAppliedToFn {
745
- attr_span : attr . span ( ) ,
747
+ attr_span,
746
748
defn_span : span,
747
749
on_crate : hir_id == CRATE_HIR_ID ,
748
750
} ) ;
0 commit comments