@@ -207,6 +207,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
207
207
Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
208
208
// handled in `check_export`
209
209
}
210
+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
211
+ self . check_ffi_const ( attr_span, target)
212
+ }
210
213
Attribute :: Parsed (
211
214
AttributeKind :: BodyStability { .. }
212
215
| AttributeKind :: ConstStabilityIndirect
@@ -304,7 +307,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
304
307
self . check_has_incoherent_inherent_impls ( attr, span, target)
305
308
}
306
309
[ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
307
- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
308
310
[ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
309
311
[ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
310
312
[ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -1509,7 +1511,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1509
1511
self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
1510
1512
return ;
1511
1513
}
1512
- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1514
+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
1513
1515
// `#[ffi_const]` functions cannot be `#[ffi_pure]`
1514
1516
self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
1515
1517
}
0 commit comments