1
Fork 0

Rollup merge of #62995 - estebank:issue-62973, r=varkor

Avoid ICE when suggestion span is at Eof

Fix #62973.
This commit is contained in:
Mazdak Farrokhzad 2019-07-28 21:19:58 +02:00 committed by GitHub
commit a3cae5740c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 85 additions and 3 deletions

View file

@ -226,7 +226,8 @@ impl CodeSuggestion {
}
}
if let Some(cur_line) = fm.get_line(cur_lo.line - 1) {
buf.push_str(&cur_line[..cur_lo.col.to_usize()]);
let end = std::cmp::min(cur_line.len(), cur_lo.col.to_usize());
buf.push_str(&cur_line[..end]);
}
}
buf.push_str(&part.snippet);