Skip to content

Commit 4f86c69

Browse files
committed
fix ICE due to empty span and empty suggestions
1 parent 19c6502 commit 4f86c69

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2596,7 +2596,9 @@ fn show_candidates(
25962596
);
25972597
if let [first, .., last] = &path[..] {
25982598
let sp = first.ident.span.until(last.ident.span);
2599-
if sp.can_be_used_for_suggestions() {
2599+
// Our suggestion is empty, so make sure the span is not empty (or we'd ICE).
2600+
// Can happen for derive-generated spans.
2601+
if sp.can_be_used_for_suggestions() && !sp.is_empty() {
26002602
err.span_suggestion_verbose(
26012603
sp,
26022604
format!("if you import `{}`, refer to it directly", last.ident),

0 commit comments

Comments
 (0)