Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Always include panic payload in panic diagnostic message - #24873

#24873
Merged
MichaReiser merged 1 commit into
mainastral-sh/ruff:mainfrom
micha/panic-dyn-anyastral-sh/ruff:micha/panic-dyn-anyCopy head branch name to clipboard
Apr 27, 2026
Merged

Always include panic payload in panic diagnostic message#24873
MichaReiser merged 1 commit into
mainastral-sh/ruff:mainfrom
micha/panic-dyn-anyastral-sh/ruff:micha/panic-dyn-anyCopy head branch name to clipboard

Conversation

@MichaReiser

@MichaReiser MichaReiser commented Apr 27, 2026

Copy link
Copy Markdown
Member

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

astral-sh-bot Bot commented Apr 27, 2026

Copy link
Copy Markdown

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
thejchap pushed a commit to thejchap/ruff that referenced this pull request May 23, 2026
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.