Skip to content

Commit

Permalink
Update ty::VariantDef to use IndexVec<FieldIdx, FieldDef>
Browse files Browse the repository at this point in the history
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`.

There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places.

Part 2/? of rust-lang/compiler-team#606
  • Loading branch information
scottmcm committed Mar 30, 2023
1 parent e88c405 commit 69b57c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/value_and_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ impl<'tcx> CPlace<'tcx> {
};
}
ty::Adt(adt_def, substs) if layout.ty.is_simd() => {
let f0_ty = adt_def.non_enum_variant().fields[0].ty(fx.tcx, substs);
let f0 = &adt_def.non_enum_variant().fields[FieldIdx::from_u32(0)];
let f0_ty = f0.ty(fx.tcx, substs);

match f0_ty.kind() {
ty::Array(_, _) => {
Expand Down

0 comments on commit 69b57c2

Please sign in to comment.