Skip to content

Commit 9a16bbd

Browse files
committed
Also prevent overflow in debug builds
1 parent 3575be6 commit 9a16bbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/librustc_errors/emitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ impl EmitterWriter {
12871287
});
12881288

12891289
// length of the code to be substituted
1290-
let snippet_len = (span_end_pos - span_start_pos) as isize;
1290+
let snippet_len = span_end_pos as isize - span_start_pos as isize;
12911291
// For multiple substitutions, use the position *after* the previous
12921292
// substitutions have happened.
12931293
offset += full_sub_len - snippet_len;

0 commit comments

Comments
 (0)