Skip to content

Commit eaa9408

Browse files
committed
Auto merge of rust-lang#85258 - GuillaumeGomez:rollup-kzay7o5, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - rust-lang#85068 (Fix diagnostic for cross crate private tuple struct constructors) - rust-lang#85175 (Rustdoc cleanup) - rust-lang#85177 (add BITS associated constant to core::num::Wrapping) - rust-lang#85240 (Don't suggest adding `'static` lifetime to arguments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 34b683f + 15a324c commit eaa9408

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/src/num/wrapping.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,21 @@ macro_rules! wrapping_int_impl {
433433
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
434434
pub const MAX: Self = Self(<$t>::MAX);
435435

436+
/// Returns the size of this integer type in bits.
437+
///
438+
/// # Examples
439+
///
440+
/// Basic usage:
441+
///
442+
/// ```
443+
/// #![feature(wrapping_int_impl)]
444+
/// use std::num::Wrapping;
445+
///
446+
#[doc = concat!("assert_eq!(<Wrapping<", stringify!($t), ">>::BITS, ", stringify!($t), "::BITS);")]
447+
/// ```
448+
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
449+
pub const BITS: u32 = <$t>::BITS;
450+
436451
/// Returns the number of ones in the binary representation of `self`.
437452
///
438453
/// # Examples

0 commit comments

Comments
 (0)