1
Fork 0

Special case the situation where the previous span is the same as the new one

This commit is contained in:
Oli Scherer 2022-02-09 17:39:28 +00:00
parent d5b6510bfb
commit 3136bfef93
5 changed files with 17 additions and 25 deletions

View file

@ -610,7 +610,11 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Ty<'_> {
concrete_type.span,
format!("expected `{}`, got `{}`", prev.ty, concrete_type.ty),
);
err.span_note(prev.span, "previous use here");
if prev.span == concrete_type.span {
err.span_label(prev.span, "this expression supplies two conflicting concrete types for the same opaque type");
} else {
err.span_note(prev.span, "previous use here");
}
err.emit();
}
} else {