about summary refs log tree commit diff
path: root/library/std/src
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 /library/std/src
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 'library/std/src')
-rw-r--r--library/std/src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index d03428dd082..e343eef9112 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -239,6 +239,7 @@
 #![cfg_attr(not(bootstrap), feature(const_fn_floating_point_arithmetic))]
 #![feature(const_fn_transmute)]
 #![feature(const_fn)]
+#![cfg_attr(not(bootstrap), feature(const_fn_fn_ptr_basics))]
 #![feature(const_ip)]
 #![feature(const_ipv6)]
 #![feature(const_raw_ptr_deref)]