Skip to content

Commit 4a7d0e9

Browse files
committed
add method_substs to CallKind
1 parent a969c19 commit 4a7d0e9

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/rustc_borrowck/src/diagnostics/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
10641064
);
10651065
}
10661066
}
1067-
CallKind::Normal { self_arg, desugaring, method_did } => {
1067+
CallKind::Normal { self_arg, desugaring, method_did, method_substs } => {
10681068
let self_arg = self_arg.unwrap();
10691069
let tcx = self.infcx.tcx;
10701070
if let Some((CallDesugaringKind::ForLoopIntoIter, _)) = desugaring {
@@ -1136,9 +1136,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11361136
&& let self_ty = infcx.replace_bound_vars_with_fresh_vars(
11371137
fn_call_span,
11381138
LateBoundRegionConversionTime::FnCall,
1139-
// FIXME: should use `subst` with the method substs.
1140-
// Probably need to add `method_substs` to `CallKind`
1141-
tcx.fn_sig(method_did).skip_binder().input(0),
1139+
tcx.fn_sig(method_did).subst(tcx, method_substs).input(0),
11421140
)
11431141
&& infcx.can_eq(self.param_env, ty, self_ty).is_ok()
11441142
{

compiler/rustc_const_eval/src/util/call_kind.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub enum CallKind<'tcx> {
4040
self_arg: Option<Ident>,
4141
desugaring: Option<(CallDesugaringKind, Ty<'tcx>)>,
4242
method_did: DefId,
43+
method_substs: SubstsRef<'tcx>,
4344
},
4445
/// A call to `Fn(..)::call(..)`, desugared from `my_closure(a, b, c)`
4546
FnCall { fn_trait_id: DefId, self_ty: Ty<'tcx> },
@@ -131,6 +132,6 @@ pub fn call_kind<'tcx>(
131132
} else {
132133
None
133134
};
134-
CallKind::Normal { self_arg, desugaring, method_did }
135+
CallKind::Normal { self_arg, desugaring, method_did, method_substs }
135136
})
136137
}

0 commit comments

Comments
 (0)