Skip to content

Commit

Permalink
tests: Remove remaining use of panic_info_message
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jun 14, 2024
1 parent 70308e0 commit 693b657
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions tests/avr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![no_main]
#![no_std]
#![warn(unsafe_op_in_unsafe_fn)]
#![feature(panic_info_message)] // <PanicInfo as fmt::Display>::fmt increases binary size than manual printing

#[macro_use]
#[path = "../../api-test/src/helper.rs"]
Expand Down Expand Up @@ -111,30 +110,14 @@ fn panic(info: &core::panic::PanicInfo<'_>) -> ! {
let pins = arduino_hal::pins!(dp);
let mut serial = semihosting::Usart(arduino_hal::default_serial!(dp, pins, 57600));

macro_rules! print {
($($tt:tt)*) => {{
use core::fmt::Write as _;
let _ = write!(serial, $($tt)*);
}};
}
macro_rules! println {
($($tt:tt)*) => {{
use core::fmt::Write as _;
let _ = writeln!(serial, $($tt)*);
}};
}

if let Some(m) = info.message() {
print!("panicked at '{m:?}'");
} else {
print!("panic occurred (no message)");
}
if let Some(l) = info.location() {
println!(", {l}");
} else {
println!(" (no location info)");
}

println!("{info}");
semihosting::exit(1)
}

Expand Down

0 comments on commit 693b657

Please sign in to comment.