diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-06-04 01:44:40 -0700 | 
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-06-05 19:15:56 -0700 | 
| commit | 8bce2255e826a11d1aa345d1786f85d22c5f921a (patch) | |
| tree | c90edaa44e96973f9ac1bab06c7d770d0be58edf /compiler/rustc_const_eval/src/interpret/call.rs | |
| parent | ccf3198de316b488ee17441935182e9d5292b4d3 (diff) | |
| download | rust-8bce2255e826a11d1aa345d1786f85d22c5f921a.tar.gz rust-8bce2255e826a11d1aa345d1786f85d22c5f921a.zip | |
Update `InterpCx::project_field` to take `FieldIdx`
As suggested by Ralf in 142005.
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 { | 
