Fix some unwanted uses of Debug formatting on user-facing messages
While formatting for user diagnostics used `Display` for all most cases, some small amount of cases used `Debug` instead. Until now, `Display` and `Debug` yielded the same output for many types. However, with path trimming, we want to show a shorter path for the user, these cases need fixing.
This commit is contained in:
parent
e36e4bd0f7
commit
75a042e74b
7 changed files with 19 additions and 18 deletions
|
@ -611,11 +611,11 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
let sig = self.tcx.fn_sig(did);
|
||||
let bound_output = sig.output();
|
||||
let output = bound_output.skip_binder();
|
||||
err.span_label(e.span, &format!("this method call resolves to `{:?}`", output));
|
||||
err.span_label(e.span, &format!("this method call resolves to `{}`", output));
|
||||
let kind = &output.kind;
|
||||
if let ty::Projection(proj) = kind {
|
||||
if let Some(span) = self.tcx.hir().span_if_local(proj.item_def_id) {
|
||||
err.span_label(span, &format!("`{:?}` defined here", output));
|
||||
err.span_label(span, &format!("`{}` defined here", output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,8 +58,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||
.tcx()
|
||||
.sess
|
||||
.struct_span_err(sp, "`impl` item signature doesn't match `trait` item signature");
|
||||
err.span_label(sp, &format!("found `{:?}`", found));
|
||||
err.span_label(trait_sp, &format!("expected `{:?}`", expected));
|
||||
err.span_label(sp, &format!("found `{}`", found));
|
||||
err.span_label(trait_sp, &format!("expected `{}`", expected));
|
||||
|
||||
// Get the span of all the used type parameters in the method.
|
||||
let assoc_item = self.tcx().associated_item(trait_def_id);
|
||||
|
@ -92,7 +92,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||
err.note_expected_found(&"", expected, &"", found);
|
||||
} else {
|
||||
// This fallback shouldn't be necessary, but let's keep it in just in case.
|
||||
err.note(&format!("expected `{:?}`\n found `{:?}`", expected, found));
|
||||
err.note(&format!("expected `{}`\n found `{}`", expected, found));
|
||||
}
|
||||
err.span_help(
|
||||
type_param_span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue