1
Fork 0

fixes panic error

fixes #127915
This commit is contained in:
surechen 2024-07-19 09:34:32 +08:00
parent 5affbb1715
commit 9747a2c3ef
3 changed files with 49 additions and 4 deletions

View file

@ -456,10 +456,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
if let Some(def_id) = def_id
&& self.infcx.tcx.def_kind(def_id).is_fn_like()
&& let Some(pos) = args.iter().position(|arg| arg.hir_id == expr.hir_id)
&& let ty::Param(_) =
self.infcx.tcx.fn_sig(def_id).skip_binder().skip_binder().inputs()
[pos + offset]
.kind()
&& let Some(arg) = self
.infcx
.tcx
.fn_sig(def_id)
.skip_binder()
.skip_binder()
.inputs()
.get(pos + offset)
&& let ty::Param(_) = arg.kind()
{
let place = &self.move_data.move_paths[mpi].place;
let ty = place.ty(self.body, self.infcx.tcx).ty;