Skip to content

Commit

Permalink
Add example/test to <int types>::BITS.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Sep 19, 2020
1 parent 3f68ae4 commit 5c30a16
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions library/core/src/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,19 @@ $EndFeature, "
pub const MAX: Self = !Self::MIN;
}

/// The size of this integer type in bits.
#[unstable(feature = "int_bits_const", issue = "none")]
pub const BITS: u32 = $BITS;
doc_comment! {
concat!("The size of this integer type in bits.
# Examples
```
", $Feature, "#![feature(int_bits_const)]
assert_eq!(", stringify!($SelfT), "::BITS, ", stringify!($BITS), ");",
$EndFeature, "
```"),
#[unstable(feature = "int_bits_const", issue = "none")]
pub const BITS: u32 = $BITS;
}

doc_comment! {
concat!("Converts a string slice in a given base to an integer.
Expand Down Expand Up @@ -2605,9 +2615,19 @@ $EndFeature, "
pub const MAX: Self = !0;
}

/// The size of this integer type in bits.
#[unstable(feature = "int_bits_const", issue = "none")]
pub const BITS: u32 = $BITS;
doc_comment! {
concat!("The size of this integer type in bits.
# Examples
```
", $Feature, "#![feature(int_bits_const)]
assert_eq!(", stringify!($SelfT), "::BITS, ", stringify!($BITS), ");",
$EndFeature, "
```"),
#[unstable(feature = "int_bits_const", issue = "none")]
pub const BITS: u32 = $BITS;
}

doc_comment! {
concat!("Converts a string slice in a given base to an integer.
Expand Down

0 comments on commit 5c30a16

Please sign in to comment.