mirror of
https://github.com/LearningOS/rust-based-os-comp2022.git
synced 2026-05-09 15:21:27 +08:00
18 lines
407 B
Rust
18 lines
407 B
Rust
use crate::exit;
|
|
|
|
#[panic_handler]
|
|
fn panic_handler(panic_info: &core::panic::PanicInfo) -> ! {
|
|
let err = panic_info.message().unwrap();
|
|
if let Some(location) = panic_info.location() {
|
|
println!(
|
|
"Panicked at {}:{}, {}",
|
|
location.file(),
|
|
location.line(),
|
|
err
|
|
);
|
|
} else {
|
|
println!("Panicked: {}", err);
|
|
}
|
|
exit(-1);
|
|
}
|