-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove #[rustc_allow_const_fn_ptr]
and add #![feature(const_fn_fn_ptr_basics)]
#77170
Conversation
rustc_allow_const_fn_ptr
and add #![feature(const_fn_fn_ptr_basics)]
#[rustc_allow_const_fn_ptr]
and add #![feature(const_fn_fn_ptr_basics)]
915f5bb
to
c02170d
Compare
☔ The latest upstream changes (presumably #77172) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
Oh this is a wondeful fix.
we could add an unsound feature like that if you want it for experimentation (though it would probably be better to just allow it via unleash and not a gate). We'll need to figure out the details around that together with trait objects and method calls in general. Note that you don't really need to fix the old min_const_fn check here, as that is just used by clippy now. We could in fact remove all feature gating logic from min_const_fn and just move it to clippy. this way it's removed from rustc and we'll just have to figure out whether we want to not just permit trivial const fns (so we'll have to adjust the logic in clippy instead of reusing the rustc logic) |
Oh nothing like that. I was trying to explain the reason I chose a verbose name here ( |
right. So this PR lgtm, r=me after a rebase |
c02170d
to
6d91b11
Compare
@bors r=oli-obk rollup |
📌 Commit 6d91b11a29a3d14f71bdef7383aeecc0e0fa1149 has been approved by |
Rollup of 12 pull requests Successful merges: - rust-lang#75454 (Explicitly document the size guarantees that Option makes.) - rust-lang#76631 (Add `x.py setup`) - rust-lang#77076 (Add missing code examples on slice iter types) - rust-lang#77093 (merge `need_type_info_err(_const)`) - rust-lang#77122 (Add `#![feature(const_fn_floating_point_arithmetic)]`) - rust-lang#77127 (Update mdBook) - rust-lang#77161 (Remove TrustedLen requirement from BuilderMethods::switch) - rust-lang#77166 (update Miri) - rust-lang#77181 (Add doc alias for pointer primitive) - rust-lang#77204 (Remove stray word from `ClosureKind::extends` docs) - rust-lang#77207 (Rename `whence` to `span`) - rust-lang#77211 (Remove unused #[allow(...)] statements from compiler/) Failed merges: - rust-lang#77170 (Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`) r? `@ghost`
☔ The latest upstream changes (presumably #77224) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
aa2e362
to
7a5ab4b
Compare
This will conflict with #77231. Better to let that one go through first. |
This 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 the bespoke attribute.
@jonas-schievink Any idea where I can find the logs for the failing rollup? A stage 1 build works and all UI tests pass for me locally on the latest master. |
Logs should be here: https://github.com/rust-lang/rust/runs/1173085918 |
16f36db
to
807260b
Compare
Seems to be working now. I removed the old failing gate test for @bors r=oli-obk |
📌 Commit 807260b has been approved by |
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
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
Rollup of 7 pull requests Successful merges: - rust-lang#76454 (UI to unit test for those using Cell/RefCell/UnsafeCell) - rust-lang#76474 (Add option to pass a custom codegen backend from a driver) - rust-lang#76711 (diag: improve closure/generic parameter mismatch) - rust-lang#77170 (Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`) - rust-lang#77194 (Add doc alias for iterator fold) - rust-lang#77288 (fix building libstd for Miri on macOS) - rust-lang#77295 (Update unstable-book: Fix ABNF in inline assembly docs) Failed merges: r? `@ghost`
rustc_allow_const_fn_ptr
was a hack to work around the lack of an escape hatch for the "minconst fn
" checks in const-stable functions. Now that we have co-optedallow_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 aconst fn
as well as function pointer casts to be performed inside aconst 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