about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-12 16:37:07 +0000
committerbors <bors@rust-lang.org>2022-03-12 16:37:07 +0000
commit22a20e3f0f952d42122370ac3628e59cd2aecfdc (patch)
tree619b87da87ab77a11675ad344196d89a3a76273b /compiler
parented2a69c4a9f3e5535461484af6266681fd7d90d4 (diff)
parent1853ffccbc0d48caa4c948f4b9e116e3ab83a58c (diff)
downloadrust-22a20e3f0f952d42122370ac3628e59cd2aecfdc.tar.gz
rust-22a20e3f0f952d42122370ac3628e59cd2aecfdc.zip
Auto merge of #94711 - ouz-a:master3, r=oli-obk
Return early to fix ICE

This fixes #94627, ICE happens because compiler tries to suggest constraining type parameter but the only constraint is implicit `std::Sized` one, so it gets removed and there is nothing to suggest resulting in ICE.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_middle/src/ty/diagnostics.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs
index 99a3d4c7fe4..7d950b79cdd 100644
--- a/compiler/rustc_middle/src/ty/diagnostics.rs
+++ b/compiler/rustc_middle/src/ty/diagnostics.rs
@@ -512,7 +512,7 @@ pub fn suggest_constraining_type_params<'a>(
         };
 
         err.span_suggestion_verbose(span, msg, suggestion, applicability);
-    } else {
+    } else if suggestions.len() > 1 {
         err.multipart_suggestion_verbose(
             "consider restricting type parameters",
             suggestions.into_iter().map(|(span, suggestion, _)| (span, suggestion)).collect(),