From 48ae217e41b38162d760f4bc1ad307afaa8947a9 Mon Sep 17 00:00:00 2001 From: hheik <4469778+hheik@users.noreply.github.com> Date: Wed, 15 May 2024 00:41:50 +0300 Subject: [PATCH] Fixed C-string usage --- theseus/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/theseus/src/lib.rs b/theseus/src/lib.rs index 359c7a4..56f1c08 100644 --- a/theseus/src/lib.rs +++ b/theseus/src/lib.rs @@ -11,17 +11,16 @@ pub mod uart; extern "C" { // printf.c - fn panic(s: *const u8); + fn panic(s: *const i8); } -/// '!RUST PANIC!\0' -static PANIC_MSG: [u8; 13] = [33, 82, 85, 83, 84, 32, 80, 65, 78, 73, 67, 33, 0]; +static PANIC_MSG: &CStr = c"!RUST PANIC!"; #[panic_handler] #[no_mangle] fn panic_handler(_info: &core::panic::PanicInfo) -> ! { unsafe { - panic(core::ptr::addr_of!(PANIC_MSG[0])); + panic(PANIC_MSG.as_ptr()); } loop {} }