Rollup merge of #127252 - fitzgen:edge-cases-for-bitwise-operations, … · model-checking/verify-rust-std@2632261 (original) (raw)

`@@ -65,8 +65,13 @@ macro_rules! uint_impl {

`

65

65

`///

`

66

66

```` /// ```


`67`

`67`

` #[doc = concat!("let n = 0b01001100", stringify!($SelfT), ";")]

`

`68`

``

`-

///

`

`69`

`68`

`/// assert_eq!(n.count_ones(), 3);

`

``

`69`

`+

///

`

``

`70`

`+

#[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")]

`

``

`71`

`+

#[doc = concat!("assert_eq!(max.count_ones(), ", stringify!($BITS), ");")]

`

``

`72`

`+

///

`

``

`73`

`+

#[doc = concat!("let zero = 0", stringify!($SelfT), ";")]

`

``

`74`

`+

/// assert_eq!(zero.count_ones(), 0);

`

`70`

`75`

```` /// ```

71

76

` #[stable(feature = "rust1", since = "1.0.0")]

`

72

77

` #[rustc_const_stable(feature = "const_math", since = "1.32.0")]

`

`@@ -86,7 +91,11 @@ macro_rules! uint_impl {

`

86

91

`/// Basic usage:

`

87

92

`///

`

88

93

```` /// ```


`89`

``

`-

#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.count_zeros(), 0);")]

`

``

`94`

`+

#[doc = concat!("let zero = 0", stringify!($SelfT), ";")]

`

``

`95`

`+

#[doc = concat!("assert_eq!(zero.count_zeros(), ", stringify!($BITS), ");")]

`

``

`96`

`+

///

`

``

`97`

`+

#[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")]

`

``

`98`

`+

/// assert_eq!(max.count_zeros(), 0);

`

`90`

`99`

```` /// ```

91

100

` #[stable(feature = "rust1", since = "1.0.0")]

`

92

101

` #[rustc_const_stable(feature = "const_math", since = "1.32.0")]

`

`@@ -108,8 +117,13 @@ macro_rules! uint_impl {

`

108

117

`///

`

109

118

```` /// ```


`110`

`119`

` #[doc = concat!("let n = ", stringify!($SelfT), "::MAX >> 2;")]

`

`111`

``

`-

///

`

`112`

`120`

`/// assert_eq!(n.leading_zeros(), 2);

`

``

`121`

`+

///

`

``

`122`

`+

#[doc = concat!("let zero = 0", stringify!($SelfT), ";")]

`

``

`123`

`+

#[doc = concat!("assert_eq!(zero.leading_zeros(), ", stringify!($BITS), ");")]

`

``

`124`

`+

///

`

``

`125`

`+

#[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")]

`

``

`126`

`+

/// assert_eq!(max.leading_zeros(), 0);

`

`113`

`127`

```` /// ```

114

128

`` #[doc = concat!("[ilog2]: ", stringify!($SelfT), "::ilog2")]

``

115

129

` #[stable(feature = "rust1", since = "1.0.0")]

`

`@@ -130,8 +144,13 @@ macro_rules! uint_impl {

`

130

144

`///

`

131

145

```` /// ```


`132`

`146`

` #[doc = concat!("let n = 0b0101000", stringify!($SelfT), ";")]

`

`133`

``

`-

///

`

`134`

`147`

`/// assert_eq!(n.trailing_zeros(), 3);

`

``

`148`

`+

///

`

``

`149`

`+

#[doc = concat!("let zero = 0", stringify!($SelfT), ";")]

`

``

`150`

`+

#[doc = concat!("assert_eq!(zero.trailing_zeros(), ", stringify!($BITS), ");")]

`

``

`151`

`+

///

`

``

`152`

`+

#[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")]

`

``

`153`

`+

#[doc = concat!("assert_eq!(max.trailing_zeros(), 0);")]

`

`135`

`154`

```` /// ```

136

155

` #[stable(feature = "rust1", since = "1.0.0")]

`

137

156

` #[rustc_const_stable(feature = "const_math", since = "1.32.0")]

`

`@@ -150,8 +169,13 @@ macro_rules! uint_impl {

`

150

169

`///

`

151

170

```` /// ```


`152`

`171`

` #[doc = concat!("let n = !(", stringify!($SelfT), "::MAX >> 2);")]

`

`153`

``

`-

///

`

`154`

`172`

`/// assert_eq!(n.leading_ones(), 2);

`

``

`173`

`+

///

`

``

`174`

`+

#[doc = concat!("let zero = 0", stringify!($SelfT), ";")]

`

``

`175`

`+

/// assert_eq!(zero.leading_ones(), 0);

`

``

`176`

`+

///

`

``

`177`

`+

#[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")]

`

``

`178`

`+

#[doc = concat!("assert_eq!(max.leading_ones(), ", stringify!($BITS), ");")]

`

`155`

`179`

```` /// ```

156

180

` #[stable(feature = "leading_trailing_ones", since = "1.46.0")]

`

157

181

` #[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")]

`

`@@ -171,8 +195,13 @@ macro_rules! uint_impl {

`

171

195

`///

`

172

196

```` /// ```


`173`

`197`

` #[doc = concat!("let n = 0b1010111", stringify!($SelfT), ";")]

`

`174`

``

`-

///

`

`175`

`198`

`/// assert_eq!(n.trailing_ones(), 3);

`

``

`199`

`+

///

`

``

`200`

`+

#[doc = concat!("let zero = 0", stringify!($SelfT), ";")]

`

``

`201`

`+

/// assert_eq!(zero.trailing_ones(), 0);

`

``

`202`

`+

///

`

``

`203`

`+

#[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")]

`

``

`204`

`+

#[doc = concat!("assert_eq!(max.trailing_ones(), ", stringify!($BITS), ");")]

`

`176`

`205`

```` /// ```

177

206

` #[stable(feature = "leading_trailing_ones", since = "1.46.0")]

`

178

207

` #[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")]

`