@@ -204,6 +204,15 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
204
204
AttributeKind :: RustcLayoutScalarValidRangeStart ( _num, attr_span)
205
205
| AttributeKind :: RustcLayoutScalarValidRangeEnd ( _num, attr_span) ,
206
206
) => 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
+ }
207
216
Attribute :: Parsed (
208
217
AttributeKind :: BodyStability { .. }
209
218
| AttributeKind :: ConstStabilityIndirect
@@ -233,6 +242,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
233
242
& Attribute :: Parsed ( AttributeKind :: PassByValue ( attr_span) ) => {
234
243
self . check_pass_by_value ( attr_span, span, target)
235
244
}
245
+ & Attribute :: Parsed ( AttributeKind :: StdInternalSymbol ( attr_span) ) => {
246
+ self . check_rustc_std_internal_symbol ( attr_span, span, target)
247
+ }
236
248
Attribute :: Unparsed ( attr_item) => {
237
249
style = Some ( attr_item. style ) ;
238
250
match attr. path ( ) . as_slice ( ) {
@@ -258,9 +270,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
258
270
) ,
259
271
[ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
260
272
[ 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
- }
264
273
[ sym:: rustc_no_implicit_autorefs, ..] => {
265
274
self . check_applied_to_fn_or_method ( hir_id, attr. span ( ) , span, target)
266
275
}
@@ -300,8 +309,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
300
309
[ sym:: rustc_has_incoherent_inherent_impls, ..] => {
301
310
self . check_has_incoherent_inherent_impls ( attr, span, target)
302
311
}
303
- [ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
304
- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
305
312
[ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
306
313
[ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
307
314
[ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -346,7 +353,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
346
353
| sym:: cfg_attr
347
354
| sym:: cfg_trace
348
355
| sym:: cfg_attr_trace
349
- | sym:: export_stable // handled in `check_export`
350
356
// need to be fixed
351
357
| sym:: cfi_encoding // FIXME(cfi_encoding)
352
358
| sym:: pointee // FIXME(derive_coerce_pointee)
@@ -1507,7 +1513,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1507
1513
self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
1508
1514
return ;
1509
1515
}
1510
- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1516
+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
1511
1517
// `#[ffi_const]` functions cannot be `#[ffi_pure]`
1512
1518
self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
1513
1519
}
@@ -2214,13 +2220,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2214
2220
}
2215
2221
}
2216
2222
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 ) {
2218
2224
match target {
2219
2225
Target :: Fn | Target :: Static | Target :: ForeignFn | Target :: ForeignStatic => { }
2220
2226
_ => {
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 } ) ;
2224
2228
}
2225
2229
}
2226
2230
}
0 commit comments