Special case the situation where the previous span is the same as the new one
This commit is contained in:
parent
d5b6510bfb
commit
3136bfef93
5 changed files with 17 additions and 25 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue