@@ -169,6 +169,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
169
169
Attribute :: Parsed ( AttributeKind :: Cold ( attr_span) ) => {
170
170
self . check_cold ( hir_id, * attr_span, span, target)
171
171
}
172
+ Attribute :: Parsed ( AttributeKind :: ExportName { span : attr_span, .. } ) => {
173
+ self . check_export_name ( hir_id, * attr_span, span, target)
174
+ }
172
175
Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
173
176
self . check_align ( span, target, * align, * repr_span)
174
177
}
@@ -223,7 +226,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
223
226
& mut doc_aliases,
224
227
) ,
225
228
[ 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) ,
227
229
[ sym:: rustc_layout_scalar_valid_range_start, ..]
228
230
| [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
229
231
self . check_rustc_layout_scalar_valid_range ( attr, span, target)
@@ -1653,7 +1655,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1653
1655
}
1654
1656
1655
1657
/// 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 ) {
1657
1659
match target {
1658
1660
Target :: Static | Target :: Fn => { }
1659
1661
Target :: Method ( ..) if self . is_impl_item ( hir_id) => { }
@@ -1662,10 +1664,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1662
1664
// erroneously allowed it and some crates used it accidentally, to be compatible
1663
1665
// with crates depending on them, we can't throw an error here.
1664
1666
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" ) ;
1666
1668
}
1667
1669
_ => {
1668
- self . dcx ( ) . emit_err ( errors:: ExportName { attr_span : attr . span ( ) , span } ) ;
1670
+ self . dcx ( ) . emit_err ( errors:: ExportName { attr_span, span } ) ;
1669
1671
}
1670
1672
}
1671
1673
}
0 commit comments