1
Fork 0

Refer to the TraitRef::identity in the message to be clearer

This commit is contained in:
Esteban Kuber 2022-03-27 02:02:07 +00:00
parent ef91519b45
commit 3109c931b4
33 changed files with 71 additions and 71 deletions

View file

@ -1763,13 +1763,12 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
if candidates.len() == 0 {
return false;
}
let trait_ref = candidates[0];
if candidates.len() == 1 {
err.highlighted_help(vec![
(
format!(
"the trait `{}` is implemented for `",
trait_ref.print_only_trait_path()
candidates[0].print_only_trait_path()
),
Style::NoStyle,
),
@ -1778,6 +1777,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
]);
return true;
}
let trait_ref = TraitRef::identity(self.tcx, candidates[0].def_id);
// Check if the trait is the same in all cases. If so, we'll only show the type.
// FIXME: there *has* to be a better way!
let mut traits: Vec<_> = candidates