@@ -204,6 +204,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
204204 Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
205205 // handled in `check_export`
206206 }
207+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
208+ self . check_ffi_const ( attr_span, target)
209+ }
207210 Attribute :: Parsed (
208211 AttributeKind :: BodyStability { .. }
209212 | AttributeKind :: ConstStabilityIndirect
@@ -298,7 +301,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
298301 self . check_has_incoherent_inherent_impls ( attr, span, target)
299302 }
300303 [ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
301- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
302304 [ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
303305 [ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
304306 [ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -1503,7 +1505,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
15031505 self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
15041506 return ;
15051507 }
1506- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1508+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
15071509 // `#[ffi_const]` functions cannot be `#[ffi_pure]`
15081510 self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
15091511 }
0 commit comments