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/const_eval/valtrees.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/const_eval/valtrees.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/const_eval/valtrees.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/valtrees.rs b/compiler/rustc_const_eval/src/const_eval/valtrees.rs index 34239ae1d15..58d230af683 100644 --- a/compiler/rustc_const_eval/src/const_eval/valtrees.rs +++ b/compiler/rustc_const_eval/src/const_eval/valtrees.rs @@ -1,4 +1,4 @@ -use rustc_abi::{BackendRepr, VariantIdx}; +use rustc_abi::{BackendRepr, FieldIdx, VariantIdx}; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_middle::mir::interpret::{EvalToValTreeResult, GlobalId, ReportedErrorInfo}; use rustc_middle::ty::layout::{LayoutCx, LayoutOf, TyAndLayout}; @@ -40,7 +40,7 @@ fn branches<'tcx>( } for i in 0..field_count { - let field = ecx.project_field(&place, i).unwrap(); + let field = ecx.project_field(&place, FieldIdx::from_usize(i)).unwrap(); let valtree = const_to_valtree_inner(ecx, &field, num_nodes)?; branches.push(valtree); } @@ -437,7 +437,7 @@ fn valtree_into_mplace<'tcx>( ty::Str | ty::Slice(_) | ty::Array(..) => { ecx.project_index(place, i as u64).unwrap() } - _ => ecx.project_field(&place_adjusted, i).unwrap(), + _ => ecx.project_field(&place_adjusted, FieldIdx::from_usize(i)).unwrap(), }; debug!(?place_inner); |
