diff options
| author | Kyle Matsuda <kyle.yoshio.matsuda@gmail.com> | 2023-01-20 15:17:01 -0700 |
|---|---|---|
| committer | Kyle Matsuda <kyle.yoshio.matsuda@gmail.com> | 2023-01-26 20:28:31 -0700 |
| commit | 4a7d0e9754aa75eb0fd37bfeb4f00562806d112f (patch) | |
| tree | 27573dc0b7d51294c05705da4be0838f2260c38b | |
| parent | a969c194d87f0fe1c30e5eeec981414e8b11dc47 (diff) | |
| download | rust-4a7d0e9754aa75eb0fd37bfeb4f00562806d112f.tar.gz rust-4a7d0e9754aa75eb0fd37bfeb4f00562806d112f.zip | |
add method_substs to CallKind
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/mod.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/util/call_kind.rs | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 18d2caa149b..1011794d7b3 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1064,7 +1064,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); } } - CallKind::Normal { self_arg, desugaring, method_did } => { + CallKind::Normal { self_arg, desugaring, method_did, method_substs } => { let self_arg = self_arg.unwrap(); let tcx = self.infcx.tcx; if let Some((CallDesugaringKind::ForLoopIntoIter, _)) = desugaring { @@ -1136,9 +1136,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { && let self_ty = infcx.replace_bound_vars_with_fresh_vars( fn_call_span, LateBoundRegionConversionTime::FnCall, - // FIXME: should use `subst` with the method substs. - // Probably need to add `method_substs` to `CallKind` - tcx.fn_sig(method_did).skip_binder().input(0), + tcx.fn_sig(method_did).subst(tcx, method_substs).input(0), ) && infcx.can_eq(self.param_env, ty, self_ty).is_ok() { diff --git a/compiler/rustc_const_eval/src/util/call_kind.rs b/compiler/rustc_const_eval/src/util/call_kind.rs index 38d9b044981..995363c0edd 100644 --- a/compiler/rustc_const_eval/src/util/call_kind.rs +++ b/compiler/rustc_const_eval/src/util/call_kind.rs @@ -40,6 +40,7 @@ pub enum CallKind<'tcx> { self_arg: Option<Ident>, desugaring: Option<(CallDesugaringKind, Ty<'tcx>)>, method_did: DefId, + method_substs: SubstsRef<'tcx>, }, /// A call to `Fn(..)::call(..)`, desugared from `my_closure(a, b, c)` FnCall { fn_trait_id: DefId, self_ty: Ty<'tcx> }, @@ -131,6 +132,6 @@ pub fn call_kind<'tcx>( } else { None }; - CallKind::Normal { self_arg, desugaring, method_did } + CallKind::Normal { self_arg, desugaring, method_did, method_substs } }) } |
