/// unreachable!("The loop should always return");
/// }
/// ```
-#[cfg(not(bootstrap))]
#[macro_export]
#[rustc_builtin_macro(unreachable)]
#[allow_internal_unstable(edition_panic)]
};
}
-/// unreachable!() macro
-#[cfg(bootstrap)]
-#[macro_export]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg_attr(not(test), rustc_diagnostic_item = "unreachable_macro")]
-#[allow_internal_unstable(core_panic)]
-macro_rules! unreachable {
- () => ({
- $crate::panicking::panic("internal error: entered unreachable code")
- });
- ($msg:expr $(,)?) => ({
- $crate::unreachable!("{}", $msg)
- });
- ($fmt:expr, $($arg:tt)*) => ({
- $crate::panic!($crate::concat!("internal error: entered unreachable code: ", $fmt), $($arg)*)
- });
-}
-
/// Indicates unimplemented code by panicking with a message of "not implemented".
///
/// This allows your code to type-check, which is useful if you are prototyping or
($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
}
- /// Same as `format_args`, but can be used in some const contexts.
+ /// Same as [`format_args`], but can be used in some const contexts.
///
/// This macro is used by the panic macros for the `const_panic` feature.
///
($fmt:expr, $($args:tt)*) => {{ /* compiler built-in */ }};
}
- /// Same as `format_args`, but adds a newline in the end.
+ /// Same as [`format_args`], but adds a newline in the end.
#[unstable(
feature = "format_args_nl",
issue = "none",