From: Andrew Cann Date: Sat, 30 Jul 2016 05:24:53 +0000 (+0800) Subject: impl Debug + Display for ! X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=ee78f37e2a68120119dcda4312db0be3b545eabe;p=rust.git impl Debug + Display for ! --- diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 173c55e35d5..60862334846 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1363,6 +1363,29 @@ fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) } fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp } +// Note: This macro is a temporary hack that can be remove once we are building with a compiler +// that supports `!` +macro_rules! argh { + () => { + #[unstable(feature = "bang_type", issue = "35121")] + impl Debug for ! { + fn fmt(&self, _: &mut Formatter) -> Result { + *self + } + } + + #[unstable(feature = "bang_type", issue = "35121")] + impl Display for ! { + fn fmt(&self, _: &mut Formatter) -> Result { + *self + } + } + } +} + +#[cfg(not(stage0))] +argh!(); + #[stable(feature = "rust1", since = "1.0.0")] impl Debug for bool { fn fmt(&self, f: &mut Formatter) -> Result {