@@ -207,6 +207,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
207207 Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
208208 // handled in `check_export`
209209 }
210+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
211+ self . check_ffi_const ( attr_span, target)
212+ }
210213 Attribute :: Parsed (
211214 AttributeKind :: BodyStability { .. }
212215 | AttributeKind :: ConstStabilityIndirect
@@ -304,7 +307,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
304307 self . check_has_incoherent_inherent_impls ( attr, span, target)
305308 }
306309 [ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
307- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
308310 [ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
309311 [ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
310312 [ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -1509,7 +1511,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
15091511 self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
15101512 return ;
15111513 }
1512- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1514+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
15131515 // `#[ffi_const]` functions cannot be `#[ffi_pure]`
15141516 self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
15151517 }
0 commit comments