fix ICE due to empty span and empty suggestions
This commit is contained in:
parent
19c65022fc
commit
4f86c69184
@ -2596,7 +2596,9 @@ fn show_candidates(
|
|||||||
);
|
);
|
||||||
if let [first, .., last] = &path[..] {
|
if let [first, .., last] = &path[..] {
|
||||||
let sp = first.ident.span.until(last.ident.span);
|
let sp = first.ident.span.until(last.ident.span);
|
||||||
if sp.can_be_used_for_suggestions() {
|
// Our suggestion is empty, so make sure the span is not empty (or we'd ICE).
|
||||||
|
// Can happen for derive-generated spans.
|
||||||
|
if sp.can_be_used_for_suggestions() && !sp.is_empty() {
|
||||||
err.span_suggestion_verbose(
|
err.span_suggestion_verbose(
|
||||||
sp,
|
sp,
|
||||||
format!("if you import `{}`, refer to it directly", last.ident),
|
format!("if you import `{}`, refer to it directly", last.ident),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user