Skip to content

[ty] Fix panic for annotation pointing at leading whitespace#23458

Merged
charliermarsh merged 1 commit intomainfrom
charlie/trim
Feb 24, 2026
Merged

[ty] Fix panic for annotation pointing at leading whitespace#23458
charliermarsh merged 1 commit intomainfrom
charlie/trim

Conversation

@charliermarsh
Copy link
Member

Summary

When a diagnostic annotation pointed at indentation (e.g., an "unexpected indentation" error), whitespace_left could exceed span_left, causing a subtraction overflow in Margin::compute.

Closes astral-sh/ty#836.

@charliermarsh charliermarsh added bug Something isn't working ty Multi-file analysis & type inference labels Feb 21, 2026
@charliermarsh charliermarsh changed the title Fix panic for annotation pointing at leading whitespace [ty] Fix panic for annotation pointing at leading whitespace Feb 21, 2026
@charliermarsh charliermarsh marked this pull request as ready for review February 21, 2026 01:17
@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 21, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thank you!

@charliermarsh charliermarsh merged commit f267aed into main Feb 24, 2026
48 checks passed
@charliermarsh charliermarsh deleted the charlie/trim branch February 24, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic attempt to subtract with overflow in ruff_annotate_snippets/src/renderer/margin.rs

2 participants