@@ -204,6 +204,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
204
204
Attribute :: Parsed ( AttributeKind :: ExportStable ) => {
205
205
// handled in `check_export`
206
206
}
207
+ & Attribute :: Parsed ( AttributeKind :: FfiConst ( attr_span) ) => {
208
+ self . check_ffi_const ( attr_span, target)
209
+ }
207
210
Attribute :: Parsed (
208
211
AttributeKind :: BodyStability { .. }
209
212
| AttributeKind :: ConstStabilityIndirect
@@ -298,7 +301,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
298
301
self . check_has_incoherent_inherent_impls ( attr, span, target)
299
302
}
300
303
[ sym:: ffi_pure, ..] => self . check_ffi_pure ( attr. span ( ) , attrs, target) ,
301
- [ sym:: ffi_const, ..] => self . check_ffi_const ( attr. span ( ) , target) ,
302
304
[ sym:: link_ordinal, ..] => self . check_link_ordinal ( attr, span, target) ,
303
305
[ sym:: link, ..] => self . check_link ( hir_id, attr, span, target) ,
304
306
[ sym:: macro_use, ..] | [ sym:: macro_escape, ..] => {
@@ -1503,7 +1505,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1503
1505
self . dcx ( ) . emit_err ( errors:: FfiPureInvalidTarget { attr_span } ) ;
1504
1506
return ;
1505
1507
}
1506
- if attrs . iter ( ) . any ( |a| a . has_name ( sym :: ffi_const ) ) {
1508
+ if find_attr ! ( attrs , AttributeKind :: FfiConst ( _ ) ) {
1507
1509
// `#[ffi_const]` functions cannot be `#[ffi_pure]`
1508
1510
self . dcx ( ) . emit_err ( errors:: BothFfiConstAndPure { attr_span } ) ;
1509
1511
}
0 commit comments