Skip to content

Conversation

@Muscraft
Copy link
Member

While running rustc's lintdoc tests, I encountered a corner case with SourceMap::span_to_lines, where it would return no LineInfo when it was passed the range 0..0, which ultimately caused a panic down the line. To address this, I made it so span_to_lines would only stop including lines when the range end was less than a LineInfo's start_byte (end < line_info.start_byte). This seems to be the correct fix, as we use its negation (end >= line_info.start_byte) when determining what line a byte falls on.

@epage epage merged commit 557126c into rust-lang:master Jun 25, 2025
15 checks passed
@Muscraft Muscraft deleted the fix-span-to-lines branch June 25, 2025 23:26
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