Skip to content

Commit 8763965

Browse files
committed
Auto merge of #97368 - tmandry:coverage-underflow, r=jyn514
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`
2 parents ae3ab14 + 2f02a4e commit 8763965

File tree

1 file changed

+1
-1
lines changed
  • compiler/rustc_mir_transform/src/coverage

1 file changed

+1
-1
lines changed

compiler/rustc_mir_transform/src/coverage/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ fn make_code_region(
514514
// Extend an empty span by one character so the region will be counted.
515515
let CharPos(char_pos) = start_col;
516516
if span.hi() == body_span.hi() {
517-
start_col = CharPos(char_pos - 1);
517+
start_col = CharPos(char_pos.saturating_sub(1));
518518
} else {
519519
end_col = CharPos(char_pos + 1);
520520
}

0 commit comments

Comments
 (0)