Auto merge of #131797 - matthiaskrgr:rollup-lzpze2k, r=matthiaskrgr · qinheping/verify-rust-std@6c85d31 (original) (raw)

`@@ -20,33 +20,22 @@ trait DisplayInt:

`

20

20

``

21

21

`macro_rules! impl_int {

`

22

22

`($($t:ident)*) => (

`

23

``

`-

(implDisplayIntfor(impl DisplayInt for (implDisplayIntfort {

`

24

``

`-

fn zero() -> Self { 0 }

`

25

``

`-

fn from_u8(u: u8) -> Self { u as Self }

`

26

``

`-

fn to_u8(&self) -> u8 { *self as u8 }

`

27

``

`-

#[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32")))]

`

28

``

`-

fn to_u32(&self) -> u32 { *self as u32 }

`

29

``

`-

fn to_u64(&self) -> u64 { *self as u64 }

`

30

``

`-

fn to_u128(&self) -> u128 { *self as u128 }

`

31

``

`-

})*

`

32

``

`-

)

`

33

``

`-

}

`

34

``

`-

macro_rules! impl_uint {

`

35

``

`-

($($t:ident)*) => (

`

36

``

`-

(implDisplayIntfor(impl DisplayInt for (implDisplayIntfort {

`

37

``

`-

fn zero() -> Self { 0 }

`

38

``

`-

fn from_u8(u: u8) -> Self { u as Self }

`

39

``

`-

fn to_u8(&self) -> u8 { *self as u8 }

`

40

``

`-

#[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32")))]

`

41

``

`-

fn to_u32(&self) -> u32 { *self as u32 }

`

42

``

`-

fn to_u64(&self) -> u64 { *self as u64 }

`

43

``

`-

fn to_u128(&self) -> u128 { *self as u128 }

`

44

``

`-

})*

`

``

23

`+

(implDisplayIntfor(impl DisplayInt for (implDisplayIntfort {

`

``

24

`+

fn zero() -> Self { 0 }

`

``

25

`+

fn from_u8(u: u8) -> Self { u as Self }

`

``

26

`+

fn to_u8(&self) -> u8 { *self as u8 }

`

``

27

`+

#[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32")))]

`

``

28

`+

fn to_u32(&self) -> u32 { *self as u32 }

`

``

29

`+

fn to_u64(&self) -> u64 { *self as u64 }

`

``

30

`+

fn to_u128(&self) -> u128 { *self as u128 }

`

``

31

`+

})*

`

45

32

`)

`

46

33

`}

`

47

34

``

48

``

`-

impl_int! { i8 i16 i32 i64 i128 isize }

`

49

``

`-

impl_uint! { u8 u16 u32 u64 u128 usize }

`

``

35

`+

impl_int! {

`

``

36

`+

i8 i16 i32 i64 i128 isize

`

``

37

`+

u8 u16 u32 u64 u128 usize

`

``

38

`+

}

`

50

39

``

51

40

`/// A type that represents a specific radix

`

52

41

`///

`

`@@ -178,26 +167,25 @@ integer! { i16, u16 }

`

178

167

`integer! { i32, u32 }

`

179

168

`integer! { i64, u64 }

`

180

169

`integer! { i128, u128 }

`

181

``

`-

macro_rules! debug {

`

182

``

`-

($($T:ident)*) => {$(

`

183

``

`-

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

`

184

``

`-

impl fmt::Debug for $T {

`

185

``

`-

#[inline]

`

186

``

`-

fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

`

187

``

`-

if f.debug_lower_hex() {

`

188

``

`-

fmt::LowerHex::fmt(self, f)

`

189

``

`-

} else if f.debug_upper_hex() {

`

190

``

`-

fmt::UpperHex::fmt(self, f)

`

191

``

`-

} else {

`

192

``

`-

fmt::Display::fmt(self, f)

`

``

170

+

``

171

`+

macro_rules! impl_Debug {

`

``

172

`+

($($T:ident)*) => {

`

``

173

`+

$(

`

``

174

`+

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

`

``

175

`+

impl fmt::Debug for $T {

`

``

176

`+

#[inline]

`

``

177

`+

fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

`

``

178

`+

if f.debug_lower_hex() {

`

``

179

`+

fmt::LowerHex::fmt(self, f)

`

``

180

`+

} else if f.debug_upper_hex() {

`

``

181

`+

fmt::UpperHex::fmt(self, f)

`

``

182

`+

} else {

`

``

183

`+

fmt::Display::fmt(self, f)

`

``

184

`+

}

`

193

185

`}

`

194

186

`}

`

195

``

`-

}

`

196

``

`-

)*};

`

197

``

`-

}

`

198

``

`-

debug! {

`

199

``

`-

i8 i16 i32 i64 i128 isize

`

200

``

`-

u8 u16 u32 u64 u128 usize

`

``

187

`+

)*

`

``

188

`+

};

`

201

189

`}

`

202

190

``

203

191

`// 2 digit decimal look up table

`

`@@ -521,6 +509,11 @@ macro_rules! impl_Exp {

`

521

509

`};

`

522

510

`}

`

523

511

``

``

512

`+

impl_Debug! {

`

``

513

`+

i8 i16 i32 i64 i128 isize

`

``

514

`+

u8 u16 u32 u64 u128 usize

`

``

515

`+

}

`

``

516

+

524

517

`// Include wasm32 in here since it doesn't reflect the native pointer size, and

`

525

518

`// often cares strongly about getting a smaller code size.

`

526

519

`#[cfg(any(target_pointer_width = "64", target_arch = "wasm32"))]

`