rust/library
Matthias Krüger 1df3a35bca
Rollup merge of #136910 - okaneco:sig_ones, r=thomcc
Implement feature `isolate_most_least_significant_one` for integer types

Accepted ACP - https://github.com/rust-lang/libs-team/issues/467
Tracking issue - #136909

Implement ACP for functions that isolate the most significant set bit and least significant set bit on unsigned, signed, and `NonZero` integers.

Add function `isolate_most_significant_one`
Add function `isolate_least_significant_one`

---

This PR adds the following impls
```rust
impl {u8, u16, u32, u64, u128, usize} {
    const fn isolate_most_significant_one(self) -> Self;
    const fn isolate_least_significant_one(self) -> Self;
}
impl {i8, i16, i32, i64, i128, isize} {
    const fn isolate_most_significant_one(self) -> Self;
    const fn isolate_least_significant_one(self) -> Self;
}
impl NonZeroT {
    const fn isolate_most_significant_one(self) -> Self;
    const fn isolate_least_significant_one(self) -> Self;
}
```
Example behavior
```rust
assert_eq!(u8::isolate_most_significant_one(0b01100100), 0b01000000);
assert_eq!(u8::isolate_least_significant_one(0b01100100), 0b00000100);
```
2025-02-22 11:36:42 +01:00
..
alloc Rollup merge of #136089 - jwong101:box-default-debug-stack-usage, r=Amanieu 2025-02-21 12:45:22 +01:00
backtrace@9d2c34e7e6 Update backtrace 2025-02-13 14:32:50 -08:00
core Rollup merge of #136910 - okaneco:sig_ones, r=thomcc 2025-02-22 11:36:42 +01:00
coretests Rollup merge of #136910 - okaneco:sig_ones, r=thomcc 2025-02-22 11:36:42 +01:00
panic_abort panic_abort: Apply unsafe_op_in_unsafe_fn 2025-02-14 07:36:17 -08:00
panic_unwind panic_unwind: Apply unsafe_op_in_unsafe_fn 2025-02-14 07:36:17 -08:00
portable-simd Remove ignored #[must_use] attributes from portable-simd 2025-02-12 13:59:22 +01:00
proc_macro proc_macro: Apply unsafe_op_in_unsafe_fn 2025-02-14 07:36:17 -08:00
profiler_builtins compiler & tools dependencies: 2024-12-17 17:41:00 +00:00
rtstartup Mark extern blocks as unsafe 2025-02-09 17:11:13 +00:00
rustc-std-workspace-alloc
rustc-std-workspace-core update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustc-std-workspace-std
std Rollup merge of #137353 - thaliaarchi:io-optional-methods/wasi-stdin, r=alexcrichton 2025-02-21 19:01:15 +01:00
stdarch@684de0d6fe Bump stdarch 2024-12-24 19:00:57 +01:00
sysroot Optionally add type names to TypeIds. 2025-02-11 18:42:19 -08:00
test Rollup merge of #136844 - thaliaarchi:const-io-error, r=ChrisDenton 2025-02-17 06:37:37 +01:00
unwind unwind: Apply unsafe_op_in_unsafe_fn 2025-02-14 07:36:17 -08:00
windows_targets Mark extern blocks as unsafe 2025-02-09 17:11:13 +00:00
Cargo.lock library: Update rand to 0.9.0 2025-02-13 12:20:55 -08:00
Cargo.toml Put all coretests in a separate crate 2025-01-26 10:26:36 +00:00