about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/cast.rs
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2025-06-04 01:44:40 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2025-06-05 19:15:56 -0700
commit8bce2255e826a11d1aa345d1786f85d22c5f921a (patch)
treec90edaa44e96973f9ac1bab06c7d770d0be58edf /compiler/rustc_const_eval/src/interpret/cast.rs
parentccf3198de316b488ee17441935182e9d5292b4d3 (diff)
downloadrust-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/cast.rs')
-rw-r--r--compiler/rustc_const_eval/src/interpret/cast.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs
index 643a5805019..9e15f4572d7 100644
--- a/compiler/rustc_const_eval/src/interpret/cast.rs
+++ b/compiler/rustc_const_eval/src/interpret/cast.rs
@@ -1,6 +1,6 @@
 use std::assert_matches::assert_matches;
 
-use rustc_abi::Integer;
+use rustc_abi::{FieldIdx, Integer};
 use rustc_apfloat::ieee::{Double, Half, Quad, Single};
 use rustc_apfloat::{Float, FloatConvert};
 use rustc_middle::mir::CastKind;
@@ -484,6 +484,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
                 let mut found_cast_field = false;
                 for i in 0..src.layout.fields.count() {
                     let cast_ty_field = cast_ty.field(self, i);
+                    let i = FieldIdx::from_usize(i);
                     let src_field = self.project_field(src, i)?;
                     let dst_field = self.project_field(dest, i)?;
                     if src_field.layout.is_1zst() && cast_ty_field.is_1zst() {