-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Use BinOp::Cmp
for iNN::signum
#137835
base: master
Are you sure you want to change the base?
Use BinOp::Cmp
for iNN::signum
#137835
Conversation
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @rust-lang/wg-const-eval |
@@ -3242,6 +3242,8 @@ pub const fn bitreverse<T: Copy>(_x: T) -> T { | |||
/// large and difficult to optimize. | |||
/// | |||
/// The stabilized version of this intrinsic is [`Ord::cmp`]. | |||
#[rustc_intrinsic_const_stable_indirect] |
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.
@RalfJung, can you remind me which teams need to sign off on using this in const?
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.
Usually lang.
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.
In the interpreter, this operator is implemented for integers and characters. That matches what the validator does. Seems worth mentioning in the doc comment that char
is supported.
Other than that, the implementation looks good and doesn't do anything odd, so seems fine to stabilize. Cc @rust-lang/wg-const-eval
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.
(drive by suggestion, not a reviewer)
This way it can use the nice new LLVM intrinsic in LLVM20.
Hello lang! I propose that we stabilize the indirect use of the This doesn't expose anything fundamentally new, since the comparison operators are const-stable on these types and thus open-coding this was already possible. Ralf says that it "seems fine" (#137835 (comment)). (The PR uses it in the implementation of the stable @rfcbot fcp merge |
Team member @scottmcm has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
@rfcbot reviewed Looks good to me. |
@rfcbot reviewed Seems like there's no interesting surface area being stabilized. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
This way it can use the nice new LLVM intrinsic in LLVM20.