1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-27 02:03:29 +04:00
rCore/kernel/src/lang.rs

23 lines
514 B
Rust
Raw Normal View History

// Rust language features implementations
use core::panic::PanicInfo;
use core::alloc::Layout;
2018-11-19 13:21:06 +04:00
use log::*;
#[lang = "eh_personality"]
extern fn eh_personality() {
}
#[panic_handler]
2018-11-19 13:21:06 +04:00
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);
2018-11-19 13:21:06 +04:00
loop { crate::arch::cpu::halt() }
2018-04-09 13:02:18 +04:00
}
#[lang = "oom"]
2018-11-19 13:21:06 +04:00
fn oom(_: Layout) -> ! {
panic!("out of memory");
}