about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAndrew Cann <shum@canndrew.org>2016-07-30 13:24:53 +0800
committerAndrew Cann <shum@canndrew.org>2016-08-13 21:37:09 +0800
commitee78f37e2a68120119dcda4312db0be3b545eabe (patch)
treee2e31f667054451c45cb42d37579cad37277ddad /src/libcore
parent082915290da2619ecc9528fb6af3fae2a9d8e997 (diff)
downloadrust-ee78f37e2a68120119dcda4312db0be3b545eabe.tar.gz
rust-ee78f37e2a68120119dcda4312db0be3b545eabe.zip
impl Debug + Display for !
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/fmt/mod.rs23
1 files changed, 23 insertions, 0 deletions
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 @@ macro_rules! fmt_refs {
 
 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 {