Skip to content

Commit

Permalink
coverage: Never decrease the start column to 0
Browse files Browse the repository at this point in the history
Line/column numbers are 1-based, so if the start column is already 1 at this
point, we would decrement it to 0 and confuse `llvm-cov`.
  • Loading branch information
Zalathar committed Jan 6, 2024
1 parent 543b472 commit bff18bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/coverage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ fn make_code_region(
if span.hi() == span.lo() {
// Extend an empty span by one character so the region will be counted.
if span.hi() == body_span.hi() {
start_col = start_col.saturating_sub(1);
start_col = start_col.saturating_sub(1).max(1);
} else {
end_col = start_col + 1;
}
Expand Down

0 comments on commit bff18bd

Please sign in to comment.