Skip to content
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

further split up const_fn feature flag #84310

Merged
merged 6 commits into from
Apr 25, 2021

Conversation

RalfJung
Copy link
Member

This continues the work on splitting up const_fn into separate feature flags:

  • const_fn_trait_bound for const fn with trait bounds
  • const_fn_unsize for unsizing coercions in const fn (looks like only dyn unsizing is still guarded here)

I don't know if there are even any things left that const_fn guards... at least libcore and liballoc do not need it any more.

@oli-obk are you currently able to do reviews?

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 18, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 22, 2021

Please move the const_fn feature from the active list to the removed list (different file)

@RalfJung
Copy link
Member Author

@oli-obk That feature gate is still used in some places, and I don't always understand what that is for -- in particular in compiler/rustc_mir/src/const_eval/fn_queries.rs:81:25 and compiler/rustc_mir/src/transform/check_consts/validation.rs:445:59. So, I don't think I know how to fully remove const_fn.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 23, 2021

replace the first one with true, all unstable functions have feature gates and all stable ones can be used without feature gates

the second one can likely just not check any feature gate, as it currently is testing for the feature gate being inactive, so there's no problem just removing the check

@RalfJung
Copy link
Member Author

That works... now I have to remove this flag from >50 tests.
I know why I didn't originally want to remove this feature flag in this PR. ;)

@RalfJung
Copy link
Member Author

Actually I take this back, something seems wrong: after doing what you proposed, the proc_macro crate builds without any const_fn_* feature even though it contains

impl<T: LambdaL> ScopedCell<T> {
    #[rustc_allow_const_fn_unstable(const_fn)]
    pub const fn new(value: <T as ApplyL<'static>>::Out) -> Self {
        ScopedCell(Cell::new(value))
    }
}

@RalfJung
Copy link
Member Author

So, I got it all to build again, but I don't think this is right. I added a new feature gate for one last use of const_fn (const_fn_in_trait), but now that error shows up in loads of new places and also there's always two errors -- the feature gate error and a hard error.

Moreover, some errors in the min_const_fn file disappeared. I have no idea why.

@RalfJung
Copy link
Member Author

Oh also this is now pointing to a commit of stdarch that is in my fork (to include rust-lang/stdarch#1140), I don't know if this will even build on CI...

@@ -108,17 +108,14 @@ const fn foo37(a: bool, b: bool) -> bool { a || b }
fn main() {}

impl<T: std::fmt::Debug> Foo<T> {
//~^ ERROR trait bounds other than `Sized` on const fn parameters are unstable
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of the diff seems wrong to me (this is also what happened in proc_macro).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the is may need its own test. The message is missing because other errors are reported first?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes no sense to me, the order of errors shouldn't change just because I got rid of a feature flag...

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 23, 2021

Actually I take this back, something seems wrong: after doing what you proposed, the proc_macro crate builds without any const_fn_* feature even though it contains

impl<T: LambdaL> ScopedCell<T> {
    #[rustc_allow_const_fn_unstable(const_fn)]
    pub const fn new(value: <T as ApplyL<'static>>::Out) -> Self {
        ScopedCell(Cell::new(value))
    }
}

It does require rustc_attrs though, so that's ok

@RalfJung
Copy link
Member Author

@Mark-Simulacrum it seems to still use the old ctfe-stress-4.rs. I found a commit sha in src/ci/pgo.sh and updated that, let's hope that's right.
@bors r=oli-obk

@bors
Copy link
Contributor

bors commented Apr 24, 2021

📌 Commit 49054c3 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 24, 2021
@bors
Copy link
Contributor

bors commented Apr 24, 2021

⌛ Testing commit 49054c3 with merge b56b175...

@bors
Copy link
Contributor

bors commented Apr 25, 2021

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing b56b175 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 25, 2021
@bors bors merged commit b56b175 into rust-lang:master Apr 25, 2021
@rustbot rustbot added this to the 1.53.0 milestone Apr 25, 2021
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #84310!

Tested on commit b56b175.
Direct link to PR: #84310

💔 rls on windows: test-pass → build-fail (cc @Xanewok).
💔 rls on linux: test-pass → build-fail (cc @Xanewok).
💔 rustfmt on windows: test-pass → build-fail (cc @calebcartwright @topecongiro).
💔 rustfmt on linux: test-pass → build-fail (cc @calebcartwright @topecongiro).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Apr 25, 2021
Tested on commit rust-lang/rust@b56b175.
Direct link to PR: <rust-lang/rust#84310>

💔 rls on windows: test-pass → build-fail (cc @Xanewok).
💔 rls on linux: test-pass → build-fail (cc @Xanewok).
💔 rustfmt on windows: test-pass → build-fail (cc @calebcartwright @topecongiro).
💔 rustfmt on linux: test-pass → build-fail (cc @calebcartwright @topecongiro).
@RalfJung RalfJung deleted the const-fn-feature-flags branch April 25, 2021 09:04
hanmertens added a commit to hanmertens/toyos-rs that referenced this pull request May 8, 2021
This is necessary since rust-lang/rust#84310, otherwise new nightlies
can't build cpuio.

Fixes emk#8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants