-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Require const stability attribute on all stable functions that are const
#90998
Conversation
Do we actually want to require With the changes already pushed, when a method is stabilized errors will be thrown if there's a method used that shouldn't/can't be. It will additionally not be possible to "accidentally" stabilize an item as const, as such annotation will be required on associated functions (this was previously not the case and is unquestionably a bug). |
If we treat the absence of a const stability attribute as being equivalent to having a |
6623e5b
to
660fb95
Compare
Coming back around to this, I think it would make the most sense to do these two changes separately. I intend on submitting a follow-up wherein the omission of Marking this PR as ready for review. It ensures that all stable functions that are r? @RalfJung @rustbot label -S-experimental -S-waiting-on-author +S-waiting-on-review |
const
This comment has been minimized.
This comment has been minimized.
660fb95
to
a4bab4a
Compare
What you suggest makes sense, but I am afraid that r? @oli-obk |
a4bab4a
to
1300f57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given what I found in the above comment, I think this PR is set now that I've updated the comments in code.
I am confused. The other call site checks 2 things:
|
Ping from triage: |
This was supposed to be the case previously, but a missed method call meant that trait impls were not checked.
1300f57
to
1911eb8
Compare
Comments have been addressed. Should be ready for review @oli-obk. A follow-up is planned for making the default unstable — I think it'll be simple but a quick modification leads to a failed test (I'm looking into it further). |
@bors r+ |
📌 Commit 1911eb8 has been approved by |
…askrgr Rollup of 2 pull requests Successful merges: - rust-lang#90998 (Require const stability attribute on all stable functions that are `const`) - rust-lang#93489 (Mark the panic_no_unwind lang item as nounwind) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR requires all stable functions (of all kinds) that are
const fn
to have a#[rustc_const_stable]
or#[rustc_const_unstable]
attribute. Stability was previously implied if omitted; a follow-up PR is planned to change the fallback to be unstable.