Re: [PATCH] panic: improve panic output from Rust panics

From: Miguel Ojeda
Date: Thu Jun 19 2025 - 12:10:39 EST


On Thu, Jun 19, 2025 at 5:11 PM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> This patch has the pretty major disadvantage that it unconditionally
> calls panic() when a Rust panic happens.

Yeah, I don't think we should do that.

Other `BUG()` calls in the kernel do a `pr_*` plus a `BUG()`, so what
we currently do is fairly common and I would expect tooling to be
aware of that alreardy. What we are missing to be on par with C is
essentially overriding the file/line.

Now, maybe `BUG()` itself could also have a way to inject a better
one-liner explanation after the file/line.

That way, we could improve not just Rust, but use it to improve other
C reports too.

Cheers,
Miguel