build(core/rust): improve panic message in debug builds
What changed, and why it matters
This is a small debugging improvement for Trezor's Rust firmware code. It changes panic error messages so that, in debug builds, the actual panic message text is shown instead of a generic placeholder 'rs'. There is no security vulnerability or fix here—just better diagnostic output for developers.
No security action required. Treat as a normal development/debugging improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit updates the panic_debug handler in core/embed/rust/src/lib.rs to call panic_info.message().as_str() and pass the resulting string to trezorhal::fatal_error::__fatal_error, falling back to ‘rs’ if no message is available. This replaces the previous hardcoded ‘rs’ string. The change only affects debug builds and improves the usefulness of fatal error diagnostics.
Changed components
core/embed/rust/src/lib.rsInspect captured patch +3 / −2
diff --git a/core/embed/rust/src/lib.rs b/core/embed/rust/src/lib.rs
index 6704c98d..d48c6af4 100644
--- a/core/embed/rust/src/lib.rs
+++ b/core/embed/rust/src/lib.rs
@@ -63,10 +63,11 @@ pub mod util;
fn panic_debug(panic_info: &core::panic::PanicInfo) -> ! {
// Filling at least the file and line information, if available.
// TODO: find out how to display message from panic_info.message()
+ let msg = panic_info.message().as_str().unwrap_or("rs");
if let Some(location) = panic_info.location() {
- trezorhal::fatal_error::__fatal_error("rs", location.file(), location.line());
+ trezorhal::fatal_error::__fatal_error(msg, location.file(), location.line());
} else {
- trezorhal::fatal_error::__fatal_error("rs", "", 0);
+ trezorhal::fatal_error::__fatal_error(msg, "", 0);
}
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.