about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-03-21 01:22:43 +0800
committeryukang <moorekang@gmail.com>2023-03-21 01:23:28 +0800
commitcbb8066321b65cc6762ee2645bea5fc050e62eee (patch)
tree9de5d3111639325a2929d341210a3281af4695cf /compiler/rustc_errors/src
parentc90eb4825a9faca0d6317292a452859f00d5b786 (diff)
downloadrust-cbb8066321b65cc6762ee2645bea5fc050e62eee.tar.gz
rust-cbb8066321b65cc6762ee2645bea5fc050e62eee.zip
Avoid ICE of attempt to add with overflow in emitter
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index bab4f31e777..9866a9bffe0 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -331,7 +331,7 @@ impl CodeSuggestion {
                     });
                     buf.push_str(&part.snippet);
                     let cur_hi = sm.lookup_char_pos(part.span.hi());
-                    if cur_hi.line == cur_lo.line {
+                    if cur_hi.line == cur_lo.line && !part.snippet.is_empty() {
                         // Account for the difference between the width of the current code and the
                         // snippet being suggested, so that the *later* suggestions are correctly
                         // aligned on the screen.