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
This commit is contained in:
commit
85a59d40f1
39 changed files with 146 additions and 135 deletions
|
@ -457,10 +457,6 @@ rustc_queries! {
|
|||
desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
|
||||
query const_fn_is_allowed_fn_ptr(key: DefId) -> bool {
|
||||
desc { |tcx| "checking if const fn allows `fn()` types: `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
|
||||
/// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`).
|
||||
query is_foreign_item(key: DefId) -> bool {
|
||||
desc { |tcx| "checking if `{}` is a foreign item", tcx.def_path_str(key) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue