From 924ba381c8541805fd1bf029213f6a1776fadb3b Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Wed, 3 Jul 2024 06:43:40 +0200 Subject: [PATCH] Update panic message handling The newest nightly stabilized `PanicMessage` with a slightly different API. This updates the API and removes the `#![feature()]` attribute. --- no_std_test/src/main.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/no_std_test/src/main.rs b/no_std_test/src/main.rs index eb3871f..e93c2eb 100644 --- a/no_std_test/src/main.rs +++ b/no_std_test/src/main.rs @@ -29,7 +29,6 @@ #![feature(start)] #![feature(core_intrinsics)] -#![feature(panic_info_message)] #![feature(alloc_error_handler)] #![no_std] extern crate libc; @@ -48,7 +47,7 @@ extern crate wee_alloc; #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; -use core::fmt::{self, write, Write}; +use core::fmt::{self, Write}; use core::intrinsics; use core::panic::PanicInfo; @@ -170,9 +169,9 @@ impl Write for Print { #[panic_handler] fn panic(info: &PanicInfo) -> ! { unsafe { libc::printf("shi1\n\0".as_ptr() as _) }; - let msg = info.message().unwrap(); + let msg = info.message(); let mut buf = Print::new(); - write(&mut buf, *msg).unwrap(); + write!(&mut buf, "{}", msg).unwrap(); buf.print(); intrinsics::abort() }