about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-26 05:33:55 +0000
committerbors <bors@rust-lang.org>2023-09-26 05:33:55 +0000
commit27b4eb96d13106332d511be2ea6d0c008a57aa6e (patch)
tree93dbb7a7e712d667f64b0642ee7994c2eaa6e2e8 /compiler/rustc_resolve/src
parenta6dce3bac50f14d6ef10f74b82c16e90bdb47d36 (diff)
parentad509633a261999ba9d73aff908d48da77e0245f (diff)
downloadrust-27b4eb96d13106332d511be2ea6d0c008a57aa6e.tar.gz
rust-27b4eb96d13106332d511be2ea6d0c008a57aa6e.zip
Auto merge of #116125 - RalfJung:const-param-ty-eq, r=compiler-errors
ConstParamTy: require Eq as supertrait

As discussed with `@BoxyUwu` [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/.60ConstParamTy.60.20and.20.60Eq.60).

We want to say that valtree equality on const generic params agrees with `==`, but that only makes sense if `==` actually exists, hence we should have an appropriate bound. Valtree equality is an equivalence relation, so such a type can always be `Eq` and not just `PartialEq`.
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 9b7fd76d103..907a6b1c46c 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -2596,7 +2596,9 @@ fn show_candidates(
             );
             if let [first, .., last] = &path[..] {
                 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(
                         sp,
                         format!("if you import `{}`, refer to it directly", last.ident),