-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
The job Click to see the possible cause of the failure (guessed by this bot)
|
(condition, true_val, false_val), | ||
select_predictable, | ||
select_actually_unpredictable, | ||
) |
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.
Wouldn't marking the select_unpredictable
intrinsic itself as const
work? It already has a fallback body equivalent to your select_predictable
.
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.
Yeah, I probably should have thought of that first…
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.
I think that this would be blocked on #145725 then, if I did that. Which I'm fine doing, I think.
Since MaybeUninit::assume_init_drop
requires ptr::drop_in_place
.
@rustbot blocked |
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.