-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
floating
macro and nofloat panic message
- Loading branch information
Showing
3 changed files
with
60 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
use crate::fmt::{Debug, Formatter, Result}; | ||
|
||
macro_rules! floating { | ||
($ty:ident) => { | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
impl Debug for $ty { | ||
#[inline] | ||
fn fmt(&self, _fmt: &mut Formatter<'_>) -> Result { | ||
panic!("floating point support is turned off"); | ||
($($ty:ident)*) => { | ||
$( | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
impl Debug for $ty { | ||
#[inline] | ||
fn fmt(&self, _fmt: &mut Formatter<'_>) -> Result { | ||
panic!("floating point fmt support is turned off"); | ||
} | ||
} | ||
} | ||
)* | ||
}; | ||
} | ||
|
||
floating! { f16 } | ||
floating! { f32 } | ||
floating! { f64 } | ||
floating! { f128 } | ||
floating! { f16 f32 f64 f128 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters