Don't add message that will never be shown to users

It will still be used in json, as seen by the ui test changes
This commit is contained in:
Oli Scherer 2022-11-11 14:45:18 +00:00
parent 014f7f4092
commit 21ce58732b
5 changed files with 6 additions and 9 deletions

View file

@ -2445,12 +2445,12 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
(Ok(l), Ok(r)) => l.line == r.line,
_ => true,
};
if !ident.span.overlaps(span) && !same_line {
if !ident.span.is_dummy() && !ident.span.overlaps(span) && !same_line {
multispan.push_span_label(ident.span, "required by a bound in this");
}
}
let descr = format!("required by a bound in `{}`", item_name);
if span != DUMMY_SP {
if !span.is_dummy() {
let msg = format!("required by this bound in `{}`", item_name);
multispan.push_span_label(span, msg);
err.span_note(multispan, &descr);