-
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
Make likely
and unlikely
const, gated by feature const_unlikely
#73778
Conversation
They are gated by internal feature gate const_likely
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 |
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 |
lgtm. I'll add it to the const eval skill tree. @rust-lang/lang This PR does two things:
The motivation for this change is to allow the Lines 1867 to 1877 in 394e1b4
Alternatively we can insta-stabilize the const-stability of the |
Please remember to remove the intrinsic implementation from Miri once this one lands. |
Note, the linked issue is about |
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
@oli-obk Note that this PR does not fix #69399, because rust/src/librustc_mir/transform/qualify_min_const_fn.rs Lines 338 to 343 in 8b43012
which is copied from rust/src/librustc_mir/transform/qualify_min_const_fn.rs Lines 318 to 323 in 8b43012
initially introduced in #68114. This is different from the behaviour of |
What's the question exactly? I'm not sure what you want to change. |
@ecstatic-morse |
I believe this was just the way it worked before, although this was broken for a while. Whats the problem with adding your library feature gate to |
It's not an issue for me, but it is blocking #69399. And it is just weird that the same attribute has different restrictions when applied to function/macro respectively. |
I don't think the current behavior is weird. Writing a macro definition is not the same as writing a function. I also don't care very much. |
I'm nominating for the @rust-lang/lang meeting today but I don't see a problem with having these functions available in const fn, presuming that we have them. They clearly have no semantic effect. This is only to make them available on an unstable basis so I think no FCP ought to be required. |
I agree that unstable things generally don't need a lang FCP, especially for intrinsics that are by nature internal and more about compiler/libs-impl concerns than about the conceptual language itself. |
Discussed this PR and gave approval in @rust-lang/lang meeting today. |
@bors r+ |
📌 Commit 8b43012 has been approved by |
…arth Rollup of 17 pull requests Successful merges: - rust-lang#72071 (Added detailed error code explanation for issue E0687 in Rust compiler.) - rust-lang#72369 (Bring net/parser.rs up to modern up to date with modern rust patterns) - rust-lang#72445 (Stabilize `#[track_caller]`.) - rust-lang#73466 (impl From<char> for String) - rust-lang#73548 (remove rustdoc warnings) - rust-lang#73649 (Fix sentence structure) - rust-lang#73678 (Update Box::from_raw example to generalize better) - rust-lang#73705 (stop taking references in Relate) - rust-lang#73716 (Document the static keyword) - rust-lang#73752 (Remap Windows ERROR_INVALID_PARAMETER to ErrorKind::InvalidInput from Other) - rust-lang#73776 (Move terminator to new module) - rust-lang#73778 (Make `likely` and `unlikely` const, gated by feature `const_unlikely`) - rust-lang#73805 (Document the type keyword) - rust-lang#73806 (Use an 'approximate' universal upper bound when reporting region errors) - rust-lang#73828 (Fix wording for anonymous parameter name help) - rust-lang#73846 (Fix comma in debug_assert! docs) - rust-lang#73847 (Edit cursor.prev() method docs in lexer) Failed merges: r? @ghost
Remove likely and unlikely from intrinsics shim They are now implemented in MIR interpreter by rust-lang/rust#73778
This PR also contains a fix to allow
#[allow_internal_unstable]
to work properly with#[rustc_const_unstable]
.cc @RalfJung @nagisa
r? @oli-obk