@@ -193,6 +193,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
193
193
Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
194
194
// handled in `check_export`
195
195
}
196
+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
197
+ self . check_ffi_const ( attr_span, target)
198
+ }
196
199
Attribute :: Parsed (
197
200
AttributeKind :: BodyStability { .. }
198
201
| AttributeKind :: ConstStabilityIndirect
@@ -286,7 +289,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
286
289
self . check_has_incoherent_inherent_impls ( attr, span, target)
287
290
}
288
291
[ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
289
- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
290
292
[ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
291
293
[ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
292
294
[ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -1474,7 +1476,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1474
1476
self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
1475
1477
return ;
1476
1478
}
1477
- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1479
+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
1478
1480
// `#[ffi_const]` functions cannot be `#[ffi_pure]`
1479
1481
self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
1480
1482
}
0 commit comments