-
Notifications
You must be signed in to change notification settings - Fork 13.8k
const select_unpredictable
#145939
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
base: master
Are you sure you want to change the base?
const select_unpredictable
#145939
Conversation
This comment has been minimized.
This comment has been minimized.
@rustbot blocked |
☔ The latest upstream changes (presumably #146052) made this pull request unmergeable. Please resolve the merge conflicts. |
c07fc68
to
c6f7eab
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
@rustbot ready Should be good, but will fix if CI shows up with any weird issues. Now that |
c6f7eab
to
003a538
Compare
let _selected = core::hint::select_unpredictable(core::hint::black_box(true), a, b); | ||
assert!(!a_dropped); | ||
assert!(b_dropped); | ||
// FIXME(const-hack): use drop(selected) instead of a scope here |
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.
Didn't want to block this on #147708 but I'll update this depending on which one gets merged first.
Tracking issue: #145938
Since constants don't actually care about branch prediction, this just uses
const_eval_select
to use a normal if statement in const-time, instead of having to make the intrinsic work in const context.Blocked by #146187.