about summary refs log tree commit diff
path: root/library/std/src/sys/args/unix.rs
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2025-04-13 11:48:20 +0000
committerGitHub <noreply@github.com>2025-04-13 11:48:20 +0000
commitf1d0b9c645d8976832ffb8e19185c644915e12e5 (patch)
tree18f51da58b6c5dd959c543d75ab01926021fc69f /library/std/src/sys/args/unix.rs
parent54aff1f6ef5260778dffee93489ec39d3352a2c8 (diff)
parent5d90ccb0fa2e9d2bb0146de225921ebc260b30bb (diff)
downloadrust-f1d0b9c645d8976832ffb8e19185c644915e12e5.tar.gz
rust-f1d0b9c645d8976832ffb8e19185c644915e12e5.zip
Rollup merge of #139726 - Amanieu:select_unpredictable_hint, r=dtolnay
Move `select_unpredictable` to the `hint` module

There has been considerable discussion in both the ACP (rust-lang/libs-team#468) and tracking issue (#133962) about whether the `bool::select_unpredictable` method should be in `core::hint` instead.

I believe this is the right move for the following reasons:
- The documentation explicitly says that it is a hint, not a codegen guarantee.
- `bool` doesn't have a corresponding `select` method, and I don't think we should be adding one.
- This shouldn't be something that people reach for with auto-completion unless they specifically understand the interactions with branch prediction. Using conditional moves can easily make code *slower* by preventing the CPU from speculating past the condition due to the data dependency.
- Although currently `core::hint` only contains no-ops, this isn't a hard rule (for example `unreachable_unchecked` is a bit of a gray area). The documentation only status that the module contains "hints to compiler that affects how code should be emitted or optimized". This is consistent with what `select_unpredictable` does.
Diffstat (limited to 'library/std/src/sys/args/unix.rs')
0 files changed, 0 insertions, 0 deletions