1
Fork 0

Do not mention long types in E0599 label

The type is already mentioned in the main message and the list of unmet
bounds.
This commit is contained in:
Esteban Küber 2022-12-14 11:26:32 -08:00
parent ba64ba8b0d
commit 2a0d7126e7
4 changed files with 12 additions and 5 deletions

View file

@ -895,7 +895,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
} else {
err.span_label(span, format!("{item_kind} cannot be called on `{ty_str}` due to unsatisfied trait bounds"));
let ty_str = if ty_str.len() > 50 {
String::new()
} else {
format!("on `{ty_str}` ")
};
err.span_label(span, format!(
"{item_kind} cannot be called {ty_str}due to unsatisfied trait bounds"
));
}
};