forked from M-Labs/artiq
parent
e285fe0d56
commit
0e32a165c2
|
@ -1,4 +1,4 @@
|
||||||
#![feature(lang_items, never_type)]
|
#![feature(never_type, panic_implementation, panic_info_message)]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
@ -328,10 +328,18 @@ pub extern fn abort() {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle] // https://github.com/rust-lang/rust/issues/{38281,51647}
|
||||||
#[lang = "panic_fmt"]
|
#[panic_implementation]
|
||||||
pub extern fn panic_fmt(args: core::fmt::Arguments, file: &'static str,
|
pub fn panic_fmt(info: &core::panic::PanicInfo) -> ! {
|
||||||
line: u32, column: u32) -> ! {
|
if let Some(location) = info.location() {
|
||||||
println!("panic at {}:{}:{}: {}", file, line, column, args);
|
print!("panic at {}:{}:{}", location.file(), location.line(), location.column());
|
||||||
|
} else {
|
||||||
|
print!("panic at unknown location");
|
||||||
|
}
|
||||||
|
if let Some(message) = info.message() {
|
||||||
|
println!(": {}", message);
|
||||||
|
} else {
|
||||||
|
println!("");
|
||||||
|
}
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue