@@ -201,6 +201,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
201201 Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
202202 // handled in `check_export`
203203 }
204+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
205+ self . check_ffi_const ( attr_span, target)
206+ }
204207 Attribute :: Parsed (
205208 AttributeKind :: BodyStability { .. }
206209 | AttributeKind :: ConstStabilityIndirect
@@ -296,7 +299,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
296299 self . check_has_incoherent_inherent_impls ( attr, span, target)
297300 }
298301 [ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
299- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
300302 [ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
301303 [ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
302304 [ 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