rCore-Tutorial-v3/user/src/lang_items.rs

12 lines
348 B
Rust
Raw Normal View History

2020-12-14 12:18:33 +04:00
use super::exit;
2020-11-18 10:48:13 +04:00
#[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);
}
2020-12-14 12:18:33 +04:00
exit(-1);
2020-11-18 10:48:13 +04:00
}