-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Deny #[rustc_const_stable]
on #[unstable]
functions
#90356
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1db92b6
to
a11d1c5
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
I thought we needed this to allow unstable const fns to be called from stable const fns. But the cases you adjusted do seem like accidents. Much more problematic to me are stable const fns that have no rustc_const_* attribute at all, as that seems like an oversight and may be an accidental constness stabilization |
Not sure I follow. This has nothing to do with the body of the function. You can still use
Definitely. I was actually surprised there weren't more.
I was planning on addressing that in a follow-up PR. My intent was to create a lint very similar to this that requires the |
that only works for language features afaicr. But... if libcore compiles with your changes, then this seems fine to me |
You'd know the details of that attribute better than myself. But yeah, libcore doesn't have any instances of the lint firing other than intrinsics (silenced for well-known reasons) and the two erroneous places. Once stdarch is updated then CI should be green. Also, was I correct in that I needed to gate the |
Yes
Cool! The PR lgtm
My brain is a sieve XD I just thought we needed that, but looks like we either don't or we don't anymore. |
Turns out your understanding was correct — even private methods need to be My initial thought is to limit this lint to |
Running into another use case for this as I tackle a bug I introduced a little bit ago re. const panic. As this doesn't seem to apply to only intrinsics as suspected, I'm going to go ahead and close this. My recommendation is to close #79551 as well. |
…, r=dtolnay Fix incorrect stability attributes These two instances were caught in rust-lang#90356, but that PR isn't going to be merged. I've extracted these to ensure it's still correct. `@rustbot` label: +A-stability +C-cleanup +S-waiting-on-review
…, r=dtolnay Fix incorrect stability attributes These two instances were caught in rust-lang#90356, but that PR isn't going to be merged. I've extracted these to ensure it's still correct. ``@rustbot`` label: +A-stability +C-cleanup +S-waiting-on-review
This adds a lint against both function declarations and extern function declarations that are
#[unstable]
but declared#[rustc_const_stable]
, as this is almost certainly a mistake.Resolves #79551
@rustbot label A-const-fn A-lint A-stability C-enhancement T-libs
cc @oli-obk