@@ -169,6 +169,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
169169 Attribute :: Parsed ( AttributeKind :: Cold ( attr_span) ) => {
170170 self . check_cold ( hir_id, * attr_span, span, target)
171171 }
172+ Attribute :: Parsed ( AttributeKind :: ExportName { span : attr_span, .. } ) => {
173+ self . check_export_name ( hir_id, * attr_span, span, target)
174+ }
172175 Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
173176 self . check_align ( span, target, * align, * repr_span)
174177 }
@@ -223,7 +226,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
223226 & mut doc_aliases,
224227 ) ,
225228 [ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
226- [ sym:: export_name, ..] => self . check_export_name ( hir_id, attr, span, target) ,
227229 [ sym:: rustc_layout_scalar_valid_range_start, ..]
228230 | [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
229231 self . check_rustc_layout_scalar_valid_range ( attr, span, target)
@@ -1653,7 +1655,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
16531655 }
16541656
16551657 /// Checks if `#[export_name]` is applied to a function or static.
1656- fn check_export_name ( & self , hir_id : HirId , attr : & Attribute , span : Span , target : Target ) {
1658+ fn check_export_name ( & self , hir_id : HirId , attr_span : Span , span : Span , target : Target ) {
16571659 match target {
16581660 Target :: Static | Target :: Fn => { }
16591661 Target :: Method ( ..) if self . is_impl_item ( hir_id) => { }
@@ -1662,10 +1664,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
16621664 // erroneously allowed it and some crates used it accidentally, to be compatible
16631665 // with crates depending on them, we can't throw an error here.
16641666 Target :: Field | Target :: Arm | Target :: MacroDef => {
1665- self . inline_attr_str_error_with_macro_def ( hir_id, attr . span ( ) , "export_name" ) ;
1667+ self . inline_attr_str_error_with_macro_def ( hir_id, attr_span , "export_name" ) ;
16661668 }
16671669 _ => {
1668- self . dcx ( ) . emit_err ( errors:: ExportName { attr_span : attr . span ( ) , span } ) ;
1670+ self . dcx ( ) . emit_err ( errors:: ExportName { attr_span, span } ) ;
16691671 }
16701672 }
16711673 }
0 commit comments