Skip to content

Commit cb94e38

Browse files
committed
rust: build_error: avoid core_panic
Suggested-by: bjorn3 <bjorn3_gh@protonmail.com> Suggested-by: Gary Guo <gary@garyguo.net> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 6837ae4 commit cb94e38

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

rust/build_error.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,14 @@
1313
//! functions could still be called in the runtime).
1414
1515
#![no_std]
16-
#![feature(core_panic)]
1716

1817
/// Panics if executed in const context, or triggers a build error if not.
1918
#[inline(never)]
2019
#[cold]
2120
#[no_mangle]
2221
#[track_caller]
2322
pub const fn build_error(msg: &'static str) -> ! {
24-
// Could also be `panic!(msg)` to avoid using unstable feature `core_panic`,
25-
// but it is not allowed in Rust 2021, while `panic!("{}", msg)` could not
26-
// yet be used in const context.
27-
core::panicking::panic(msg);
23+
panic!("{}", msg);
2824
}
2925

3026
#[cfg(CONFIG_RUST_BUILD_ASSERT_WARN)]

0 commit comments

Comments
 (0)