1
Fork 0

Point at method call when it is the source of the bound error

This commit is contained in:
Esteban Küber 2022-12-11 14:49:50 -08:00
parent ce486d538b
commit 2838b8e515
29 changed files with 93 additions and 161 deletions

View file

@ -3108,6 +3108,16 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
point_at_chain(expr);
}
}
let call_node = hir.find(call_hir_id);
if let Some(Node::Expr(hir::Expr {
kind: hir::ExprKind::MethodCall(path, rcvr, ..),
..
})) = call_node
{
if Some(rcvr.span) == err.span.primary_span() {
err.replace_span_with(path.ident.span);
}
}
if let Some(Node::Expr(hir::Expr {
kind:
hir::ExprKind::Call(hir::Expr { span, .. }, _)