@@ -201,6 +201,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
201
201
Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
202
202
// handled in `check_export`
203
203
}
204
+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
205
+ self . check_ffi_const ( attr_span, target)
206
+ }
204
207
Attribute :: Parsed (
205
208
AttributeKind :: BodyStability { .. }
206
209
| AttributeKind :: ConstStabilityIndirect
@@ -296,7 +299,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
296
299
self . check_has_incoherent_inherent_impls ( attr, span, target)
297
300
}
298
301
[ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
299
- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
300
302
[ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
301
303
[ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
302
304
[ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -1503,7 +1505,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1503
1505
self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
1504
1506
return ;
1505
1507
}
1506
- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1508
+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
1507
1509
// `#[ffi_const]` functions cannot be `#[ffi_pure]`
1508
1510
self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
1509
1511
}
0 commit comments