Skip to content

Commit

Permalink
Auto merge of rust-lang#101514 - nvzqz:nvzqz/stabilize-nonzero-bits, …
Browse files Browse the repository at this point in the history
…r=thomcc

Stabilize `nonzero_bits`

Closes rust-lang#94881, implemented by rust-lang#93292.

This change stabilizes the associated `BITS` constant for `NonZero{U,I}{8,16,32,64,128,size}` integers, e.g.:

```rs
impl NonZeroUsize {
    pub const BITS: u32 = usize::BITS;
}
```
  • Loading branch information
bors committed Dec 4, 2022
2 parents fd02567 + db57653 commit 9e77211
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1249,12 +1249,11 @@ macro_rules! nonzero_bits {
/// # Examples
///
/// ```
/// #![feature(nonzero_bits)]
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
///
#[doc = concat!("assert_eq!(", stringify!($Ty), "::BITS, ", stringify!($Int), "::BITS);")]
/// ```
#[unstable(feature = "nonzero_bits", issue = "94881")]
#[stable(feature = "nonzero_bits", since = "CURRENT_RUSTC_VERSION")]
pub const BITS: u32 = <$Int>::BITS;
}
)+
Expand Down

0 comments on commit 9e77211

Please sign in to comment.