Skip to content

Commit 5c29a94

Browse files
ad-anssiMark-Simulacrum
authored andcommitted
replacing sub's that can wrap by saturating_sub's
1 parent 5b3a05a commit 5c29a94

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc_errors/emitter.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -959,15 +959,15 @@ impl EmitterWriter {
959959
'_',
960960
line_offset + pos,
961961
width_offset + depth,
962-
code_offset + annotation.start_col - left,
962+
(code_offset + annotation.start_col).saturating_sub(left),
963963
style,
964964
);
965965
}
966966
_ if self.teach => {
967967
buffer.set_style_range(
968968
line_offset,
969-
code_offset + annotation.start_col - left,
970-
code_offset + annotation.end_col - left,
969+
(code_offset + annotation.start_col).saturating_sub(left),
970+
(code_offset + annotation.end_col).saturating_sub(left),
971971
style,
972972
annotation.is_primary,
973973
);

0 commit comments

Comments
 (0)