Skip to content

Commit c7c4020

Browse files
Merge pull request #11 from sdemos/master
Fix builds on latest nightly by using `panic_implementation` instead of `panic_fmt`
2 parents ab2317f + 844d60f commit c7c4020

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

uefi-services/src/lib.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#![no_std]
1313

1414
#![feature(lang_items)]
15+
#![feature(panic_implementation)]
1516

1617
// These crates are required.
1718
extern crate rlibc;
@@ -93,13 +94,14 @@ fn init_alloc() {
9394
#[lang = "eh_personality"]
9495
fn eh_personality() {}
9596

96-
#[lang = "panic_fmt"]
97-
#[no_mangle]
98-
pub fn panic_fmt(fmt: core::fmt::Arguments, file_line_col: &(&'static str, u32, u32)) {
99-
let &(file, line, column) = file_line_col;
100-
101-
error!("Panic in {} at ({}, {}):", file, line, column);
102-
error!("{}", fmt);
97+
#[panic_implementation]
98+
fn panic_fmt(info: &core::panic::PanicInfo) -> ! {
99+
if let Some(location) = info.location() {
100+
error!("Panic in {} at ({}, {}):", location.file(), location.line(), location.column());
101+
if let Some(message) = info.message() {
102+
error!("{}", info.message())
103+
}
104+
}
103105

104106
loop {
105107
// TODO: add a timeout then shutdown.

0 commit comments

Comments
 (0)