Skip to content

Commit 1853ffc

Browse files
committed
don't call multipart_suggestion
1 parent b930efb commit 1853ffc

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

compiler/rustc_middle/src/ty/diagnostics.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,6 @@ pub fn suggest_constraining_type_params<'a>(
325325
}
326326
}
327327

328-
// This check is always run on non-valid code
329-
// to not trigger ICE
330-
if constraints.is_empty() && suggestions.is_empty() {
331-
return false;
332-
}
333-
334328
if constraints.is_empty() {
335329
continue;
336330
}
@@ -518,7 +512,7 @@ pub fn suggest_constraining_type_params<'a>(
518512
};
519513

520514
err.span_suggestion_verbose(span, msg, suggestion, applicability);
521-
} else {
515+
} else if suggestions.len() > 1 {
522516
err.multipart_suggestion_verbose(
523517
"consider restricting type parameters",
524518
suggestions.into_iter().map(|(span, suggestion, _)| (span, suggestion)).collect(),

0 commit comments

Comments
 (0)