@@ -204,6 +204,15 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
204204 AttributeKind :: RustcLayoutScalarValidRangeStart ( _num, attr_span)
205205 | AttributeKind :: RustcLayoutScalarValidRangeEnd ( _num, attr_span) ,
206206 ) => self . check_rustc_layout_scalar_valid_range ( * attr_span, span, target) ,
207+ Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
208+ // handled in `check_export`
209+ }
210+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
211+ self . check_ffi_const ( attr_span, target)
212+ }
213+ & Attribute :: Parsed ( AttributeKind :: FfiPure ( attr_span) ) => {
214+ self . check_ffi_pure ( attr_span, attrs, target)
215+ }
207216 Attribute :: Parsed (
208217 AttributeKind :: BodyStability { .. }
209218 | AttributeKind :: ConstStabilityIndirect
@@ -233,6 +242,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
233242 & Attribute :: Parsed ( AttributeKind :: PassByValue ( attr_span) ) => {
234243 self . check_pass_by_value ( attr_span, span, target)
235244 }
245+ & Attribute :: Parsed ( AttributeKind :: StdInternalSymbol ( attr_span) ) => {
246+ self . check_rustc_std_internal_symbol ( attr_span, span, target)
247+ }
236248 Attribute :: Unparsed ( attr_item) => {
237249 style = Some ( attr_item. style ) ;
238250 match attr. path ( ) . as_slice ( ) {
@@ -258,9 +270,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
258270 ) ,
259271 [ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
260272 [ sym:: debugger_visualizer, ..] => self . check_debugger_visualizer ( attr, target) ,
261- [ sym:: rustc_std_internal_symbol, ..] => {
262- self . check_rustc_std_internal_symbol ( attr, span, target)
263- }
264273 [ sym:: rustc_no_implicit_autorefs, ..] => {
265274 self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
266275 }
@@ -300,8 +309,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
300309 [ sym:: rustc_has_incoherent_inherent_impls, ..] => {
301310 self . check_has_incoherent_inherent_impls ( attr, span, target)
302311 }
303- [ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
304- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
305312 [ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
306313 [ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
307314 [ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -346,7 +353,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
346353 | sym:: cfg_attr
347354 | sym:: cfg_trace
348355 | sym:: cfg_attr_trace
349- | sym:: export_stable // handled in `check_export`
350356 // need to be fixed
351357 | sym:: cfi_encoding // FIXME(cfi_encoding)
352358 | sym:: pointee // FIXME(derive_coerce_pointee)
@@ -1507,7 +1513,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
15071513 self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
15081514 return ;
15091515 }
1510- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1516+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
15111517 // `#[ffi_const]` functions cannot be `#[ffi_pure]`
15121518 self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
15131519 }
@@ -2214,13 +2220,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
22142220 }
22152221 }
22162222
2217- fn check_rustc_std_internal_symbol ( & self , attr : & Attribute , span : Span , target : Target ) {
2223+ fn check_rustc_std_internal_symbol ( & self , attr_span : Span , span : Span , target : Target ) {
22182224 match target {
22192225 Target :: Fn | Target :: Static | Target :: ForeignFn | Target :: ForeignStatic => { }
22202226 _ => {
2221- self . tcx
2222- . dcx ( )
2223- . emit_err ( errors:: RustcStdInternalSymbol { attr_span : attr. span ( ) , span } ) ;
2227+ self . tcx . dcx ( ) . emit_err ( errors:: RustcStdInternalSymbol { attr_span, span } ) ;
22242228 }
22252229 }
22262230 }
0 commit comments