-
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
Allow calling const unsafe fn
in const fn
behind a feature gate
#55635
Conversation
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.
Tests look mostly good :)
} | ||
// not ok | ||
const unsafe fn foo8_2() -> i32 { | ||
foo4() //~ ERROR not allowed in const fn |
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.
The error message doesn't seem great here; the user isn't made aware that it can be fixed by wrapping in unsafe { ... }
so knowing how to fix it sort of depends on having been introduced to the tracking issue / PR.
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.
It may indeed be worth having an extra note like:
= note: unsafe actions within a `const unsafe fn` still require an `unsafe` block
Passing the review over to Ralf; r? @RalfJung |
This doesn't actually allow any new operations in Unfortunately most of this is code that I am not at all familiar with, so I cannot judge the side-effects this may have. @Centril does that mean you would r+ and just want to get my opinion as well? @oli-obk I am a bit confused why there are two places where it makes the body of an |
|
The intention is that calling
I mainly want someone who is more familiar with the compiler internals than me (e.g. you) to review the code and see that it is correct and such; but if you are not familiar with the code maybe let's pass it to a third person (e.g. eddyb) to also check it? |
cc @arielb1 who wrote the original unsafety checker for MIR |
The unsafety checker I can at least read because it works on MIR (but I wouldn't call that familiarity); the |
This comment has been minimized.
This comment has been minimized.
411ceea
to
3844277
Compare
#[repr(transparent)] | ||
pub(crate) struct NonZero<T>(pub(crate) T); | ||
pub(crate) struct NonZero<T: Freeze>(pub(crate) T); |
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.
Glad this is not exported anymore!
5102c82
to
9604080
Compare
💔 Test failed - status-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Uh... @alexcrichton @nrc what is the correct procedure for landing something that breaks a |
@oli-obk in theory there's no procedure as we just publish a new version of rustc-ap-syntax every night, whatever the nightly happened to be released with. I've just fixed a bug where it stopped running for a week or so, so maybe that's all that was needed? Does that help? I fear I may be missing context about what's actually needed here |
I made a breaking change to From your statement it sounds like that's normally fine, so it might be that that in turn would have broken rls, and since we're in publishing week, we can't break tools. I am currently investigating if I can work around it by a targeted application of |
Hm that's odd because that breakage should be impossible, the |
It's in the logs above.... But I think I know the issue: I changed language semantics for the forever-unstable feature |
Ah yes indeed! If that breaks crates on crates.io that's fine, it just means that until the release happens (where we require the RLS compiles) this won't be able to land. After the release though this can land, it'll break the RLS, and then the RLS will update to a newer version of the crate on crates.io as it's naturally published. |
@bors retry |
☀️ Test successful - status-appveyor, status-travis |
📣 Toolstate changed by #55635! Tested on commit 128a1fa. 💔 miri on windows: test-pass → test-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). |
Tested on commit rust-lang/rust@128a1fa. Direct link to PR: <rust-lang/rust#55635> 💔 miri on windows: test-pass → test-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 miri on linux: test-pass → test-fail (cc @oli-obk @RalfJung @eddyb, @rust-lang/infra). 💔 rls on windows: test-pass → build-fail (cc @nrc @Xanewok, @rust-lang/infra). 💔 rls on linux: test-pass → build-fail (cc @nrc @Xanewok, @rust-lang/infra). 💔 rustfmt on windows: test-pass → build-fail (cc @nrc, @rust-lang/infra). 💔 rustfmt on linux: test-pass → build-fail (cc @nrc, @rust-lang/infra).
cc #55607
r? @Centril