Skip to content

Commit 3941ef3

Browse files
committed
use panic_implementation instead of panic_fmt
this change was merged in rust-lang/rust#50338.
1 parent ebb82a8 commit 3941ef3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

uefi-services/src/lib.rs

+9-6
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,12 +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);
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+
}
102105

103106
loop {
104107
// TODO: add a timeout then shutdown.

0 commit comments

Comments
 (0)