@@ -163,6 +163,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
163
163
Attribute :: Parsed ( AttributeKind :: Cold ( attr_span) ) => {
164
164
self . check_cold ( hir_id, * attr_span, span, target)
165
165
}
166
+ Attribute :: Parsed ( AttributeKind :: ExportName { span : attr_span, .. } ) => {
167
+ self . check_export_name ( hir_id, * attr_span, span, target)
168
+ }
166
169
Attribute :: Parsed ( AttributeKind :: Align { align, span : repr_span } ) => {
167
170
self . check_align ( span, target, * align, * repr_span)
168
171
}
@@ -217,7 +220,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
217
220
& mut doc_aliases,
218
221
) ,
219
222
[ 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) ,
221
223
[ sym:: rustc_layout_scalar_valid_range_start, ..]
222
224
| [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
223
225
self . check_rustc_layout_scalar_valid_range ( attr, span, target)
@@ -1649,7 +1651,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1649
1651
}
1650
1652
1651
1653
/// 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 ) {
1653
1655
match target {
1654
1656
Target :: Static | Target :: Fn => { }
1655
1657
Target :: Method ( ..) if self . is_impl_item ( hir_id) => { }
@@ -1658,10 +1660,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1658
1660
// erroneously allowed it and some crates used it accidentally, to be compatible
1659
1661
// with crates depending on them, we can't throw an error here.
1660
1662
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" ) ;
1662
1664
}
1663
1665
_ => {
1664
- self . dcx ( ) . emit_err ( errors:: ExportName { attr_span : attr . span ( ) , span } ) ;
1666
+ self . dcx ( ) . emit_err ( errors:: ExportName { attr_span, span } ) ;
1665
1667
}
1666
1668
}
1667
1669
}
0 commit comments