Skip to content

Commit

Permalink
Auto merge of rust-lang#97368 - tmandry:coverage-underflow, r=jyn514
Browse files Browse the repository at this point in the history
coverage: Don't underflow column number

I noticed this when running coverage on a debug build of rustc. There
may be other places that do this but I'm just fixing the one I hit.

r? `@wesleywiser` `@richkadel`
  • Loading branch information
bors committed Apr 26, 2023
2 parents ae3ab14 + 2f02a4e commit 8763965
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 @@ -514,7 +514,7 @@ fn make_code_region(
// Extend an empty span by one character so the region will be counted.
let CharPos(char_pos) = start_col;
if span.hi() == body_span.hi() {
start_col = CharPos(char_pos - 1);
start_col = CharPos(char_pos.saturating_sub(1));
} else {
end_col = CharPos(char_pos + 1);
}
Expand Down

0 comments on commit 8763965

Please sign in to comment.