From 565710b33cb20c901b8b3371d1364cf7fb11e79b Mon Sep 17 00:00:00 2001 From: Loïc BRANSTETT Date: Fri, 21 Jan 2022 23:04:06 +0100 Subject: Fix invalid special casing of the unreachable! macro --- library/core/src/macros/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'library/core/src/macros/mod.rs') 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")] -- cgit 1.4.1-3-g733a5