@@ -75,22 +75,9 @@ struct PostExpansionVisitor<'a> {
7575
7676impl < ' a > PostExpansionVisitor < ' a > {
7777 #[ allow( rustc:: untranslatable_diagnostic) ] // FIXME: make this translatable
78- fn check_abi ( & self , abi : ast:: StrLit , constness : ast :: Const ) {
78+ fn check_abi ( & self , abi : ast:: StrLit ) {
7979 let ast:: StrLit { symbol_unescaped, span, .. } = abi;
8080
81- if let ast:: Const :: Yes ( _) = constness {
82- match symbol_unescaped {
83- // Stable
84- sym:: Rust | sym:: C => { }
85- abi => gate ! (
86- & self ,
87- const_extern_fn,
88- span,
89- format!( "`{}` as a `const fn` ABI is unstable" , abi)
90- ) ,
91- }
92- }
93-
9481 match abi:: is_enabled ( self . features , span, symbol_unescaped. as_str ( ) ) {
9582 Ok ( ( ) ) => ( ) ,
9683 Err ( abi:: AbiDisabled :: Unstable { feature, explain } ) => {
@@ -110,9 +97,9 @@ impl<'a> PostExpansionVisitor<'a> {
11097 }
11198 }
11299
113- fn check_extern ( & self , ext : ast:: Extern , constness : ast :: Const ) {
100+ fn check_extern ( & self , ext : ast:: Extern ) {
114101 if let ast:: Extern :: Explicit ( abi, _) = ext {
115- self . check_abi ( abi, constness ) ;
102+ self . check_abi ( abi) ;
116103 }
117104 }
118105
@@ -239,7 +226,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
239226 match & i. kind {
240227 ast:: ItemKind :: ForeignMod ( foreign_module) => {
241228 if let Some ( abi) = foreign_module. abi {
242- self . check_abi ( abi, ast :: Const :: No ) ;
229+ self . check_abi ( abi) ;
243230 }
244231 }
245232
@@ -341,7 +328,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
341328 match & ty. kind {
342329 ast:: TyKind :: BareFn ( bare_fn_ty) => {
343330 // Function pointers cannot be `const`
344- self . check_extern ( bare_fn_ty. ext , ast :: Const :: No ) ;
331+ self . check_extern ( bare_fn_ty. ext ) ;
345332 self . check_late_bound_lifetime_defs ( & bare_fn_ty. generic_params ) ;
346333 }
347334 ast:: TyKind :: Never => {
@@ -446,7 +433,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
446433 fn visit_fn ( & mut self , fn_kind : FnKind < ' a > , span : Span , _: NodeId ) {
447434 if let Some ( header) = fn_kind. header ( ) {
448435 // Stability of const fn methods are covered in `visit_assoc_item` below.
449- self . check_extern ( header. ext , header . constness ) ;
436+ self . check_extern ( header. ext ) ;
450437 }
451438
452439 if let FnKind :: Closure ( ast:: ClosureBinder :: For { generic_params, .. } , ..) = fn_kind {
0 commit comments