diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-06 23:53:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-06 23:53:18 +0200 |
| commit | 3a6f1b03757ce930ad0010e8d76cc0cf6518a535 (patch) | |
| tree | 21225b76270688091b6fc372a92e36f931c13d17 /compiler/rustc_const_eval/src/interpret/call.rs | |
| parent | 2946ce29ed456df5664e315dee888902b7ac3ec5 (diff) | |
| parent | f9cf0964db531b234e374dfd6330e0aa0c427db0 (diff) | |
| download | rust-3a6f1b03757ce930ad0010e8d76cc0cf6518a535.tar.gz rust-3a6f1b03757ce930ad0010e8d76cc0cf6518a535.zip | |
Rollup merge of #142103 - scottmcm:fieldidx-in-interp, r=oli-obk
Update `InterpCx::project_field` to take `FieldIdx` As suggested by Ralf in https://github.com/rust-lang/rust/pull/142005#discussion_r2125839015
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/call.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/call.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index 789baea0734..37677f9e048 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs @@ -62,7 +62,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { pub(super) fn fn_arg_field( &self, arg: &FnArg<'tcx, M::Provenance>, - field: usize, + field: FieldIdx, ) -> InterpResult<'tcx, FnArg<'tcx, M::Provenance>> { interp_ok(match arg { FnArg::Copy(op) => FnArg::Copy(self.project_field(op, field)?), @@ -600,10 +600,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { Cow::from( args.iter() .map(|a| interp_ok(a.clone())) - .chain( - (0..untuple_arg.layout().fields.count()) - .map(|i| self.fn_arg_field(untuple_arg, i)), - ) + .chain((0..untuple_arg.layout().fields.count()).map(|i| { + self.fn_arg_field(untuple_arg, FieldIdx::from_usize(i)) + })) .collect::<InterpResult<'_, Vec<_>>>()?, ) } else { |
