@@ -163,6 +163,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
163163 Attribute :: Parsed ( AttributeKind :: Cold ( attr_span) ) => {
164164 self . check_cold ( hir_id, * attr_span, span, target)
165165 }
166+ Attribute :: Parsed ( AttributeKind :: ExportName { span : attr_span, .. } ) => {
167+ self . check_export_name ( hir_id, * attr_span, span, target)
168+ }
166169 Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
167170 self . check_align ( span, target, * align, * repr_span)
168171 }
@@ -217,7 +220,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
217220 & mut doc_aliases,
218221 ) ,
219222 [ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
220- [ sym:: export_name, ..] => self . check_export_name ( hir_id, attr, span, target) ,
221223 [ sym:: rustc_layout_scalar_valid_range_start, ..]
222224 | [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
223225 self . check_rustc_layout_scalar_valid_range ( attr, span, target)
@@ -1649,7 +1651,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
16491651 }
16501652
16511653 /// Checks if `#[export_name]` is applied to a function or static.
1652- fn check_export_name ( & self , hir_id : HirId , attr : & Attribute , span : Span , target : Target ) {
1654+ fn check_export_name ( & self , hir_id : HirId , attr_span : Span , span : Span , target : Target ) {
16531655 match target {
16541656 Target :: Static | Target :: Fn => { }
16551657 Target :: Method ( ..) if self . is_impl_item ( hir_id) => { }
@@ -1658,10 +1660,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
16581660 // erroneously allowed it and some crates used it accidentally, to be compatible
16591661 // with crates depending on them, we can't throw an error here.
16601662 Target :: Field | Target :: Arm | Target :: MacroDef => {
1661- self . inline_attr_str_error_with_macro_def ( hir_id, attr . span ( ) , "export_name" ) ;
1663+ self . inline_attr_str_error_with_macro_def ( hir_id, attr_span , "export_name" ) ;
16621664 }
16631665 _ => {
1664- self . dcx ( ) . emit_err ( errors:: ExportName { attr_span : attr . span ( ) , span } ) ;
1666+ self . dcx ( ) . emit_err ( errors:: ExportName { attr_span, span } ) ;
16651667 }
16661668 }
16671669 }
0 commit comments