about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-05 07:14:52 +0000
committerbors <bors@rust-lang.org>2018-06-05 07:14:52 +0000
commitf33db06e1d95249de95202664340d8639ec15c57 (patch)
tree9dccf99b059f6a8268ca5dbfda49ef992376ad1f /src/librustc_errors
parentf9157f5b869fdb14308eaf6778d01ee3d0e1268a (diff)
parent9a16bbd9487b5b639230b673a40c54efa14f65ee (diff)
downloadrust-f33db06e1d95249de95202664340d8639ec15c57.tar.gz
rust-f33db06e1d95249de95202664340d8639ec15c57.zip
Auto merge of #51324 - oli-obk:debug_overflow, r=estebank
Also prevent overflow in debug builds

r? @estebank
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index f65acf08c86..92e72fe91d3 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -1287,7 +1287,7 @@ impl EmitterWriter {
                         });
 
                         // length of the code to be substituted
-                        let snippet_len = (span_end_pos - span_start_pos) as isize;
+                        let snippet_len = span_end_pos as isize - span_start_pos as isize;
                         // For multiple substitutions, use the position *after* the previous
                         // substitutions have happened.
                         offset += full_sub_len - snippet_len;