about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/const_eval/fn_queries.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-09-28 18:39:44 +0200
committerGitHub <noreply@github.com>2020-09-28 18:39:44 +0200
commit85a59d40f102015d3493e9af301e48a6f083ef48 (patch)
treea165b825dbac5fb58c20af7ff1b2f1124d917f34 /compiler/rustc_mir/src/const_eval/fn_queries.rs
parent88ae20d8aa44f1f0fadddfa5c529784732d7b101 (diff)
parent807260be9fae2612b66bffaadf6e7a7b0b216cdc (diff)
downloadrust-85a59d40f102015d3493e9af301e48a6f083ef48.tar.gz
rust-85a59d40f102015d3493e9af301e48a6f083ef48.zip
Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obk
Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`

`rustc_allow_const_fn_ptr` was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need a bespoke attribute.

Now this functionality is gated under `const_fn_fn_ptr_basics` (how concise!), and `#[allow_internal_unstable(const_fn_fn_ptr_basics)]` replaces `#[rustc_allow_const_fn_ptr]`. `const_fn_fn_ptr_basics` allows function pointer types to appear in the arguments and locals of a `const fn` as well as function pointer casts to be performed inside a `const fn`. Both of these were allowed in constants and statics already. Notably, this does **not** allow users to invoke function pointers in a const context. Presumably, we will use a nicer name for that (`const_fn_ptr`?).

r? @oli-obk
Diffstat (limited to 'compiler/rustc_mir/src/const_eval/fn_queries.rs')
-rw-r--r--compiler/rustc_mir/src/const_eval/fn_queries.rs6
1 files changed, 0 insertions, 6 deletions
diff --git a/compiler/rustc_mir/src/const_eval/fn_queries.rs b/compiler/rustc_mir/src/const_eval/fn_queries.rs
index 1db1f6ceeda..aca822a05bd 100644
--- a/compiler/rustc_mir/src/const_eval/fn_queries.rs
+++ b/compiler/rustc_mir/src/const_eval/fn_queries.rs
@@ -151,17 +151,11 @@ fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
         }
 }
 
-fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
-    is_const_fn(tcx, def_id)
-        && tcx.lookup_const_stability(def_id).map(|stab| stab.allow_const_fn_ptr).unwrap_or(false)
-}
-
 pub fn provide(providers: &mut Providers) {
     *providers = Providers {
         is_const_fn_raw,
         is_const_impl_raw: |tcx, def_id| is_const_impl_raw(tcx, def_id.expect_local()),
         is_promotable_const_fn,
-        const_fn_is_allowed_fn_ptr,
         ..*providers
     };
 }