Skip to content

Commit 924ba38

Browse files
committed
Update panic message handling
The newest nightly stabilized `PanicMessage` with a slightly different API. This updates the API and removes the `#![feature()]` attribute.
1 parent 614fe81 commit 924ba38

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

no_std_test/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
3030
#![feature(start)]
3131
#![feature(core_intrinsics)]
32-
#![feature(panic_info_message)]
3332
#![feature(alloc_error_handler)]
3433
#![no_std]
3534
extern crate libc;
@@ -48,7 +47,7 @@ extern crate wee_alloc;
4847
#[global_allocator]
4948
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
5049

51-
use core::fmt::{self, write, Write};
50+
use core::fmt::{self, Write};
5251
use core::intrinsics;
5352
use core::panic::PanicInfo;
5453

@@ -170,9 +169,9 @@ impl Write for Print {
170169
#[panic_handler]
171170
fn panic(info: &PanicInfo) -> ! {
172171
unsafe { libc::printf("shi1\n\0".as_ptr() as _) };
173-
let msg = info.message().unwrap();
172+
let msg = info.message();
174173
let mut buf = Print::new();
175-
write(&mut buf, *msg).unwrap();
174+
write!(&mut buf, "{}", msg).unwrap();
176175
buf.print();
177176
intrinsics::abort()
178177
}

0 commit comments

Comments
 (0)