Use TraitRef::to_string sorting in favor of TraitRef::ord, as the latter compares DefIds which we need to avoid

This commit is contained in:
Oli Scherer 2024-03-21 12:55:28 +00:00
parent 2707ac9606
commit ae24fef028
48 changed files with 257 additions and 257 deletions

View file

@ -2117,7 +2117,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
})
.collect();
impl_candidates.sort();
impl_candidates.sort_by_key(|tr| tr.to_string());
impl_candidates.dedup();
return report(impl_candidates, err);
}
@ -2143,7 +2143,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
cand
})
.collect();
impl_candidates.sort_by_key(|cand| (cand.similarity, cand.trait_ref));
impl_candidates.sort_by_key(|cand| (cand.similarity, cand.trait_ref.to_string()));
let mut impl_candidates: Vec<_> =
impl_candidates.into_iter().map(|cand| cand.trait_ref).collect();
impl_candidates.dedup();