about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-01-21 21:54:49 +0000
committerMichael Goulet <michael@errs.io>2023-01-23 17:02:50 +0000
commitbed3bb53d207c1bf92c26833e8d3d4280550f83e (patch)
tree4b566b202437a862ba0ff592926f88518f1f66d0 /compiler
parentc8e6a9e8b6251bbc8276cb78cabe1998deecbed7 (diff)
downloadrust-bed3bb53d207c1bf92c26833e8d3d4280550f83e.tar.gz
rust-bed3bb53d207c1bf92c26833e8d3d4280550f83e.zip
Don't resolve type var roots in point_at_expr_source_of_inferred_type
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_typeck/src/demand.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs
index bd1626dff79..d8cca55a8f8 100644
--- a/compiler/rustc_hir_typeck/src/demand.rs
+++ b/compiler/rustc_hir_typeck/src/demand.rs
@@ -270,7 +270,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             lt_op: |_| self.tcx.lifetimes.re_erased,
             ct_op: |c| c,
             ty_op: |t| match *t.kind() {
-                ty::Infer(ty::TyVar(vid)) => self.tcx.mk_ty_infer(ty::TyVar(self.root_var(vid))),
+                ty::Infer(ty::TyVar(_)) => self.tcx.mk_ty_var(ty::TyVid::from_u32(0)),
                 ty::Infer(ty::IntVar(_)) => {
                     self.tcx.mk_ty_infer(ty::IntVar(ty::IntVid { index: 0 }))
                 }
@@ -333,6 +333,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                             // inferred in this method call.
                             let arg = &args[i];
                             let arg_ty = self.node_ty(arg.hir_id);
+                            if !arg.span.overlaps(mismatch_span) {
                             err.span_label(
                                 arg.span,
                                 &format!(
@@ -340,6 +341,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                                      inferred as `{ty}`",
                                 ),
                             );
+                            }
                             param_args.insert(param_ty, (arg, arg_ty));
                         }
                     }