1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 16:36:18 +04:00
rCore/kernel/src/lang.rs
2018-11-19 20:11:17 +08:00

23 lines
514 B
Rust

// Rust language features implementations
use core::panic::PanicInfo;
use core::alloc::Layout;
use log::*;
#[lang = "eh_personality"]
extern fn eh_personality() {
}
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
let location = info.location().unwrap();
let message = info.message().unwrap();
error!("\n\nPANIC in {} at line {}\n {}", location.file(), location.line(), message);
loop { crate::arch::cpu::halt() }
}
#[lang = "oom"]
fn oom(_: Layout) -> ! {
panic!("out of memory");
}