Skip to content

Always include panic payload in panic diagnostic message#24873

Merged
MichaReiser merged 1 commit intomainfrom
micha/panic-dyn-any
Apr 27, 2026
Merged

Always include panic payload in panic diagnostic message#24873
MichaReiser merged 1 commit intomainfrom
micha/panic-dyn-any

Conversation

@MichaReiser
Copy link
Copy Markdown
Member

@MichaReiser MichaReiser commented Apr 27, 2026

Our panic handler omits the panic payload if it is neither a str or String today. This can be confusing because it appears the user's report misses the crucial message, when in fact it's simply that the panic body is a non-string value (see astral-sh/ty#3339).

This PR changes the diagnostic rendering to always include the panic payload, even if it's just a Box<dyn Any>. While that isn't terribly useful on its own, it at least indicates that the panic body isn't a string value. This PR also adds special handling for salsa::Cancelled, as these are the most likely non-stringish panic bodies in ty.

This aligns the behavior with what we use in mdtests.

@MichaReiser MichaReiser added the diagnostics Related to reporting of diagnostics. label Apr 27, 2026
@MichaReiser MichaReiser changed the title micha/panic dyn any Always include panic payload in panic diagnostic message Apr 27, 2026
@MichaReiser MichaReiser marked this pull request as ready for review April 27, 2026 09:15
@astral-sh-bot
Copy link
Copy Markdown

astral-sh-bot Bot commented Apr 27, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser merged commit 043a858 into main Apr 27, 2026
50 checks passed
@MichaReiser MichaReiser deleted the micha/panic-dyn-any branch April 27, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants