2018-10-23 20:05:13 +04:00
|
|
|
// Rust language features implementations
|
2018-04-04 16:56:56 +04:00
|
|
|
|
2018-06-19 19:43:40 +04:00
|
|
|
use core::panic::PanicInfo;
|
2018-08-04 12:20:25 +04:00
|
|
|
use core::alloc::Layout;
|
2018-04-04 16:56:56 +04:00
|
|
|
|
|
|
|
#[lang = "eh_personality"]
|
|
|
|
extern fn eh_personality() {
|
|
|
|
}
|
|
|
|
|
2018-09-08 21:25:14 +04:00
|
|
|
#[panic_handler]
|
2018-04-04 16:56:56 +04:00
|
|
|
#[no_mangle]
|
2018-06-19 19:43:40 +04:00
|
|
|
pub 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-10-23 20:05:13 +04:00
|
|
|
use arch::cpu::halt;
|
|
|
|
loop { halt() }
|
2018-04-09 13:02:18 +04:00
|
|
|
}
|
2018-06-19 19:43:40 +04:00
|
|
|
|
|
|
|
#[lang = "oom"]
|
|
|
|
#[no_mangle]
|
2018-08-04 12:20:25 +04:00
|
|
|
pub fn oom(_: Layout) -> ! {
|
2018-06-19 19:43:40 +04:00
|
|
|
panic!("out of memory");
|
|
|
|
}
|