Refactor floating macro and nofloat panic message · qinheping/verify-rust-std@bfd32fa (original) (raw)

`@@ -20,15 +20,15 @@ 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

``

`-

})*

`

``

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

32

`)

`

33

33

`}

`

34

34

``

`@@ -169,21 +169,23 @@ integer! { i64, u64 }

`

169

169

`integer! { i128, u128 }

`

170

170

``

171

171

`macro_rules! impl_Debug {

`

172

``

`-

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

`

173

``

`-

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

`

174

``

`-

impl fmt::Debug for $T {

`

175

``

`-

#[inline]

`

176

``

`-

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

`

177

``

`-

if f.debug_lower_hex() {

`

178

``

`-

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

`

179

``

`-

} else if f.debug_upper_hex() {

`

180

``

`-

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

`

181

``

`-

} else {

`

182

``

`-

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

`

``

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

`+

}

`

183

185

`}

`

184

186

`}

`

185

``

`-

}

`

186

``

`-

)*};

`

``

187

`+

)*

`

``

188

`+

};

`

187

189

`}

`

188

190

``

189

191

`// 2 digit decimal look up table

`

`@@ -508,8 +510,8 @@ macro_rules! impl_Exp {

`

508

510

`}

`

509

511

``

510

512

`impl_Debug! {

`

511

``

`-

i8 i16 i32 i64 i128 isize

`

512

``

`-

u8 u16 u32 u64 u128 usize

`

``

513

`+

i8 i16 i32 i64 i128 isize

`

``

514

`+

u8 u16 u32 u64 u128 usize

`

513

515

`}

`

514

516

``

515

517

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

`