about summary refs log tree commit diff
path: root/library/core/src/macros
diff options
context:
space:
mode:
authorLoïc BRANSTETT <lolo.branstett@numericable.fr>2022-01-21 23:04:06 +0100
committerLoïc BRANSTETT <lolo.branstett@numericable.fr>2022-01-31 17:09:31 +0100
commit565710b33cb20c901b8b3371d1364cf7fb11e79b (patch)
treeea8b01a50153f7188172d0a924b86fa30471d4a2 /library/core/src/macros
parent86f5e177bca8121e1edc9864023a8ea61acf9034 (diff)
downloadrust-565710b33cb20c901b8b3371d1364cf7fb11e79b.tar.gz
rust-565710b33cb20c901b8b3371d1364cf7fb11e79b.zip
Fix invalid special casing of the unreachable! macro
Diffstat (limited to 'library/core/src/macros')
-rw-r--r--library/core/src/macros/mod.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 0cc428d6962..a9e90556f6c 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -594,6 +594,22 @@ macro_rules! writeln {
 ///     unreachable!("The loop should always return");
 /// }
 /// ```
+#[cfg(not(bootstrap))]
+#[macro_export]
+#[rustc_builtin_macro(unreachable)]
+#[allow_internal_unstable(edition_panic)]
+#[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "unreachable_macro")]
+macro_rules! unreachable {
+    // Expands to either `$crate::panic::unreachable_2015` or `$crate::panic::unreachable_2021`
+    // depending on the edition of the caller.
+    ($($arg:tt)*) => {
+        /* compiler built-in */
+    };
+}
+
+/// unreachable!() macro
+#[cfg(bootstrap)]
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[cfg_attr(not(test), rustc_diagnostic_item = "unreachable_macro")]