Rollup merge of #62995 - estebank:issue-62973, r=varkor
Avoid ICE when suggestion span is at Eof Fix #62973.
This commit is contained in:
commit
a3cae5740c
4 changed files with 85 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue