1
Fork 0

Rollup merge of #109403 - chenyukang:yukang/fix-109396, r=estebank

Avoid ICE of attempt to add with overflow in emitter

Fixes #109396
r? ```@estebank```
This commit is contained in:
Matthias Krüger 2023-03-21 19:00:13 +01:00 committed by GitHub
commit 25b062d586
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 1 deletions

View file

@ -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.