Change:
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("panicked at ")?; self.location.fmt(formatter)?; <ins> formatter.write_str(":")?; </ins> if let Some(message) = self.message { <del> formatter.write_str(":n")?; </del> <ins> formatter.write_str("n")?; </ins> formatter.write_fmt(*message)?; } else if let Some(payload) = self.payload.downcast_ref::<&'static str>() { <del> formatter.write_str(":n")?; </del> <ins> formatter.write_str("n")?; </ins> formatter.write_str(payload)?; } // NOTE: we cannot use downcast_ref::<String>() here

Discussion:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. If you cannot produce a minimal reproduction case (something that would work in isolation), please provide the steps or even link to a repository that causes the problematic output to occur. --The following occurs when running the tests Given the following code: When the tests are ran, the current output is: After figuring out what the actual issue is, the error message makes sense. But my debugging journey would have been more pleasant, if the source location of the panics were included in the message. Much like the location of "non-nested" panics are printed. <!-- The following is not always necessary. --Ideally the output should look like: At least include the source location of the "inner" panic, or ideally both. It also suggests to rerun pass with '--lib', which is a bit misleading. If above is not possible, at least print the name of the test that is failing. <!-- If the problem is not self-explanatory, please provide a rationale for the change. --<!-- If dramatically different output is caused by small changes, consider also adding them here. If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. The output might also be different depending on the Edition. --
When run through instead of a test: () The full panic message and backtrace for the second panic is printed: <details<summaryOutput</summary</detailsI think when run as a test, the panic output is captured (as normal for a test), but is then not printed because of the abort. label -A-diagnostics -T-compiler +A-libtest (I'm not sure what the correct team assignment for this is...)
The output capturing mechanism has code to try to prevent capturing output from a double-panic: But the panic message is actually written into a string first:
re your prev. comment That doesn't happen anymore, with rust 1.75.0, it seems to be a regression, all I get is what the shows, even with rust nightly with RUST_BACKTRACE on: so, no stack trace.

The actual double panic stacktrace is inside that from: <details<summaryclick me to expand contents </summarybut to get the above output, I had to use a rust patch: </detailsIs it a regression ? Or am I missing something here. How was it able to print the stacktrace before (back in 2022 when you made the comment) but now can't ?! EDIT: Also, this means, it doesn't get to execute a potential user-set panic hook. EDIT2: I've confirmed that indeed the stacktrace is shown with EDIT3: Regression found, curiously 1 year and 10 days later: EDIT4: first glance appears to be but I'll try to double check.
Yeah indeed, today even in this just prints which is pretty barren. Not sure if it would make sense to try and catch panics during message formatting, and then still print a backtrace but without a message, or so. That may be what ; I am not entirely sure.