about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/macros.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index d82147947de..0c91542e5eb 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -211,7 +211,15 @@ macro_rules! debug_assert_eq(
 /// ```
 #[macro_export]
 macro_rules! unreachable(
-    () => (panic!("internal error: entered unreachable code"))
+    () => ({
+        panic!("internal error: entered unreachable code")
+    });
+    ($msg:expr) => ({
+        unreachable!("{}", $msg)
+    });
+    ($fmt:expr, $($arg:tt)*) => ({
+        panic!(concat!("internal error: entered unreachable code: ", $fmt), $($arg)*)
+    });
 )
 
 /// A standardised placeholder for marking unfinished code. It panics with the