1
Fork 0

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`.
This commit is contained in:
bors 2023-09-26 05:33:55 +00:00
commit 27b4eb96d1
5 changed files with 44 additions and 6 deletions

View file

@ -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),