-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Get rid of "const_fn" feature gate #84510
Comments
Regarding "const fn in trait", I think what happens is that currently, parsing this is gated on |
How can we reject it in the parser? We need to know about bounds and similar which we usually check on the HIR I think? |
I mean this: trait Foo {
const fn bar();
} I think this is not currently allowed under any conditions, is it? We accept it in the parser if |
oh... yea, just forbid that without any way to enable it |
Turns out we already forbid it:
So, I think we can just remove the feature gate check. |
All right, opened #84544 for that. What is still confusing me a lot is this one:
This is inside is_min_const_fn . What does that even mean? In the past I think we had two const-checkers, and is_min_const_fn decided whether the "minimal" or the "full" checker was used. Nowadays, we only have one checker, right? So should is_min_const_fn even still exist?There is exactly one call site:
The result is then passed to the unsafety checker where it has exactly one consequence:
I don't think whether something is "min" or "not-min" |
yea, all mentions of "min_const_fn" should disappear and instead just be checks for whether the function is_const_fn_raw |
Always reject `const fn` in `trait` during parsing. 'const fn' in trait are rejected in the AST: /~https://github.com/rust-lang/rust/blob/b78c0d8a4d5af91a4a55d029293e3ecb879ec142/compiler/rustc_ast_passes/src/ast_validation.rs#L1411 So this feature gate check is a NOP and we can just remove it. The src/test/ui/feature-gates/feature-gate-min_const_fn.rs and src/test/ui/feature-gates/feature-gate-const_fn.rs tests ensure that we still reject `const fn` in `trait` Cc rust-lang#84510 r? `@oli-obk`
All right, #84547 is underway doing that. This means there is just one reference to the
This is probably what caused the strange side-effects last time... since this is about trait bounds, maybe the most sensible thing to do is to use the const_fn_trait_bound feature gate instead of the const_fn feature gate?
|
Yea, that sounds like the best thing to do here |
Though I'm moderately confused about the inversion of the check |
I would have thought that means we can just scrap the check entirely instead of using a different feature gate |
Always reject `const fn` in `trait` during parsing. 'const fn' in trait are rejected in the AST: /~https://github.com/rust-lang/rust/blob/b78c0d8a4d5af91a4a55d029293e3ecb879ec142/compiler/rustc_ast_passes/src/ast_validation.rs#L1411 So this feature gate check is a NOP and we can just remove it. The src/test/ui/feature-gates/feature-gate-min_const_fn.rs and src/test/ui/feature-gates/feature-gate-const_fn.rs tests ensure that we still reject `const fn` in `trait` Cc rust-lang#84510 r? ``@oli-obk``
All right, with #84556 the last effect of |
Get rid of is_min_const_fn This removes the last trace of the min_const_fn mechanism by making the unsafety checker agnostic about whether something is a min or "non-min" const fn. It seems this distinction was used to disallow some features inside `const fn`, but that is the responsibility of the const checker, not of the unsafety checker. No test seems to even notice this change in the unsafety checker so I guess we are good... r? `@oli-obk` Cc rust-lang#84510
Always reject `const fn` in `trait` during parsing. 'const fn' in trait are rejected in the AST: /~https://github.com/rust-lang/rust/blob/b78c0d8a4d5af91a4a55d029293e3ecb879ec142/compiler/rustc_ast_passes/src/ast_validation.rs#L1411 So this feature gate check is a NOP and we can just remove it. The src/test/ui/feature-gates/feature-gate-min_const_fn.rs and src/test/ui/feature-gates/feature-gate-const_fn.rs tests ensure that we still reject `const fn` in `trait` Cc rust-lang#84510 r? `@oli-obk`
use correct feature flag for impl-block-level trait bounds on const fn I am not sure what that special hack was needed for, but it doesn't seem needed any more... This removes the last use of the `const_fn` feature flag -- Cc rust-lang#84510 r? `@oli-obk`
With #84556 having landed, the |
remove const_fn feature gate Fixes rust-lang#84510 r? `@oli-obk`
This feature gate was removed from rust in rust-lang/rust#84510 and so no longer compiles in rust nightly.
remove const_fn feature gate Fixes rust-lang/rust#84510 r? `@oli-obk`
707: Prepare for the next release r=taiki-e a=taiki-e - crossbeam-epoch 0.9.4 -> 0.9.5 - Fix UB in `Pointable` impl of `[MaybeUninit<T>]` (#694) - Support targets that do not have atomic CAS on stable Rust (#698) - Fix breakage with nightly feature due to rust-lang/rust#84510 (#692) - crossbeam-queue 0.3.1 -> 0.3.2 - Support targets that do not have atomic CAS on stable Rust (#698) - crossbeam-utils 0.8.4 -> 0.8.5 - Add `AtomicCell::fetch_update` (#704) - Support targets that do not have atomic CAS on stable Rust (#698) - crossbeam 0.8.0 -> 0.8.1 - Support targets that do not have atomic CAS on stable Rust (#698) Closes #702 Co-authored-by: Taiki Endo <te316e89@gmail.com>
With #84310, the const-checking analysis in
compiler/rustc_mir/src/transform/check_consts
no longer cares about theconst_fn
feature gate. So it's time we remove it entirely. That, however, turns out to be non-trivial -- I tried.const_fn
any more:const fn
, leading to errors disappearing in themin_const_fn
test.Cc @rust-lang/wg-const-eval
The text was updated successfully, but these errors were encountered: