Skip to content

Conversation

@Muscraft
Copy link
Member

rustc has a test for annotating a no-break space near the start of a line with whitespace following it. annotate-snippets currently fails this test because it uses std::char::is_whitespace for calculating whitespace_left, which treats no-break space as whitespace, leading whitespace_left to be larger than label_right, which causes a subtract with overflow panic. rustc gets around this by using rustc_parse::is_whitespace, which does not treat a no-break space as whitespace. That solution only masks the problem, as it would still panic when annotating whitespace chars with more whitespace following them. Instead, this PR fixes the Margin calculations to allow annotating whitespace before more whitespace.

@epage epage merged commit ffa5268 into rust-lang:master Oct 28, 2025
14 of 15 checks passed
@Muscraft Muscraft deleted the fix-annotating-leading-whitespace branch October 28, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants