From cb94e38bef72bad574293e08c31f583447108ad9 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Thu, 2 Dec 2021 22:23:51 +0100 Subject: [PATCH] rust: build_error: avoid `core_panic` Suggested-by: bjorn3 Suggested-by: Gary Guo Signed-off-by: Miguel Ojeda --- rust/build_error.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/rust/build_error.rs b/rust/build_error.rs index d79851cb5b96a2..34e589149d3ef3 100644 --- a/rust/build_error.rs +++ b/rust/build_error.rs @@ -13,7 +13,6 @@ //! functions could still be called in the runtime). #![no_std] -#![feature(core_panic)] /// Panics if executed in const context, or triggers a build error if not. #[inline(never)] @@ -21,10 +20,7 @@ #[no_mangle] #[track_caller] pub const fn build_error(msg: &'static str) -> ! { - // Could also be `panic!(msg)` to avoid using unstable feature `core_panic`, - // but it is not allowed in Rust 2021, while `panic!("{}", msg)` could not - // yet be used in const context. - core::panicking::panic(msg); + panic!("{}", msg); } #[cfg(CONFIG_RUST_BUILD_ASSERT_WARN)]