Skip to content

Commit f3b3ac5

Browse files
committed
Move panic handler to compiler builtins
It fits better and allows to build `compiler_builtins` independently. Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8374974 commit f3b3ac5

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

rust/compiler_builtins.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,14 @@ define_panicking_intrinsics!("`u128` should not be used", {
133133
__udivti3,
134134
__umodti3,
135135
});
136+
137+
extern "C" {
138+
fn rust_helper_BUG() -> !;
139+
}
140+
141+
#[panic_handler]
142+
fn panic(_info: &core::panic::PanicInfo) -> ! {
143+
unsafe {
144+
rust_helper_BUG();
145+
}
146+
}

rust/kernel/lib.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#[cfg(not(CONFIG_RUST))]
3131
compile_error!("Missing kernel configuration for conditional compilation");
3232

33-
use core::panic::PanicInfo;
34-
3533
mod allocator;
3634

3735
#[doc(hidden)]
@@ -130,17 +128,6 @@ impl<'a> Drop for KParamGuard<'a> {
130128
}
131129
}
132130

133-
extern "C" {
134-
fn rust_helper_BUG() -> !;
135-
}
136-
137-
#[panic_handler]
138-
fn panic(_info: &PanicInfo) -> ! {
139-
unsafe {
140-
rust_helper_BUG();
141-
}
142-
}
143-
144131
/// Calculates the offset of a field from the beginning of the struct it belongs to.
145132
///
146133
/// # Example

0 commit comments

Comments
 (0)