Skip to content

Commit eb3e9c1

Browse files
committed
Auto merge of rust-lang#109762 - scottmcm:variantdef-indexvec, r=WaffleLapkin
Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>` 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
2 parents 276029d + 4abb455 commit eb3e9c1

File tree

47 files changed

+127
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+127
-104
lines changed

compiler/rustc_borrowck/src/diagnostics/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
350350
if !including_tuple_field.0 && variant.ctor_kind() == Some(CtorKind::Fn) {
351351
return None;
352352
}
353-
Some(variant.fields[field.index()].name.to_string())
353+
Some(variant.fields[field].name.to_string())
354354
}
355355
ty::Tuple(_) => Some(field.index().to_string()),
356356
ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => {

compiler/rustc_borrowck/src/type_check/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
854854
},
855855
};
856856

857-
if let Some(field) = variant.fields.get(field.index()) {
857+
if let Some(field) = variant.fields.get(field) {
858858
Ok(self.cx.normalize(field.ty(tcx, substs), location))
859859
} else {
860860
Err(FieldAccessError::OutOfRange { field_count: variant.fields.len() })
@@ -1725,7 +1725,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
17251725
AggregateKind::Adt(adt_did, variant_index, substs, _, active_field_index) => {
17261726
let def = tcx.adt_def(adt_did);
17271727
let variant = &def.variant(variant_index);
1728-
let adj_field_index = active_field_index.unwrap_or(field_index);
1728+
let adj_field_index =
1729+
FieldIdx::from_usize(active_field_index.unwrap_or(field_index));
17291730
if let Some(field) = variant.fields.get(adj_field_index) {
17301731
Ok(self.normalize(field.ty(tcx, substs), location))
17311732
} else {

compiler/rustc_codegen_cranelift/src/value_and_place.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,8 @@ impl<'tcx> CPlace<'tcx> {
701701
};
702702
}
703703
ty::Adt(adt_def, substs) if layout.ty.is_simd() => {
704-
let f0_ty = adt_def.non_enum_variant().fields[0].ty(fx.tcx, substs);
704+
let f0 = &adt_def.non_enum_variant().fields[FieldIdx::from_u32(0)];
705+
let f0_ty = f0.ty(fx.tcx, substs);
705706

706707
match f0_ty.kind() {
707708
ty::Array(_, _) => {

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ fn build_enum_variant_struct_type_di_node<'ll, 'tcx>(
274274
.map(|field_index| {
275275
let field_name = if variant_def.ctor_kind() != Some(CtorKind::Fn) {
276276
// Fields have names
277-
Cow::from(variant_def.fields[field_index].name.as_str())
277+
let field = &variant_def.fields[FieldIdx::from_usize(field_index)];
278+
Cow::from(field.name.as_str())
278279
} else {
279280
// Tuple-like
280281
super::tuple_field_name(field_index)

compiler/rustc_const_eval/src/const_eval/valtrees.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::interpret::{
88
use crate::interpret::{MPlaceTy, Value};
99
use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt};
1010
use rustc_span::source_map::DUMMY_SP;
11-
use rustc_target::abi::{Align, VariantIdx, FIRST_VARIANT};
11+
use rustc_target::abi::{Align, FieldIdx, VariantIdx, FIRST_VARIANT};
1212

1313
#[instrument(skip(ecx), level = "debug")]
1414
fn branches<'tcx>(
@@ -412,6 +412,7 @@ fn valtree_into_mplace<'tcx>(
412412

413413
let inner_ty = match ty.kind() {
414414
ty::Adt(def, substs) => {
415+
let i = FieldIdx::from_usize(i);
415416
def.variant(FIRST_VARIANT).fields[i].ty(tcx, substs)
416417
}
417418
ty::Tuple(inner_tys) => inner_tys[i],

compiler/rustc_const_eval/src/interpret/validity.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ use rustc_middle::mir::interpret::InterpError;
1616
use rustc_middle::ty;
1717
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1818
use rustc_span::symbol::{sym, Symbol};
19-
use rustc_target::abi::{Abi, Scalar as ScalarAbi, Size, VariantIdx, Variants, WrappingRange};
19+
use rustc_target::abi::{
20+
Abi, FieldIdx, Scalar as ScalarAbi, Size, VariantIdx, Variants, WrappingRange,
21+
};
2022

2123
use std::hash::Hash;
2224

@@ -269,14 +271,16 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
269271
match layout.variants {
270272
Variants::Single { index } => {
271273
// Inside a variant
272-
PathElem::Field(def.variant(index).fields[field].name)
274+
PathElem::Field(def.variant(index).fields[FieldIdx::from_usize(field)].name)
273275
}
274276
Variants::Multiple { .. } => bug!("we handled variants above"),
275277
}
276278
}
277279

278280
// other ADTs
279-
ty::Adt(def, _) => PathElem::Field(def.non_enum_variant().fields[field].name),
281+
ty::Adt(def, _) => {
282+
PathElem::Field(def.non_enum_variant().fields[FieldIdx::from_usize(field)].name)
283+
}
280284

281285
// arrays/slices
282286
ty::Array(..) | ty::Slice(..) => PathElem::ArrayElem(field),

compiler/rustc_const_eval/src/transform/validate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
360360
}
361361
ty::Adt(adt_def, substs) => {
362362
let var = parent_ty.variant_index.unwrap_or(FIRST_VARIANT);
363-
let Some(field) = adt_def.variant(var).fields.get(f.as_usize()) else {
363+
let Some(field) = adt_def.variant(var).fields.get(f) else {
364364
fail_out_of_bounds(self, location);
365365
return;
366366
};

compiler/rustc_hir_analysis/src/check/check.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use rustc_middle::ty::{
2727
use rustc_session::lint::builtin::{UNINHABITED_STATIC, UNSUPPORTED_CALLING_CONVENTIONS};
2828
use rustc_span::symbol::sym;
2929
use rustc_span::{self, Span};
30+
use rustc_target::abi::FieldIdx;
3031
use rustc_target::spec::abi::Abi;
3132
use rustc_trait_selection::traits::error_reporting::on_unimplemented::OnUnimplementedDirective;
3233
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
@@ -474,7 +475,7 @@ fn is_enum_of_nonnullable_ptr<'tcx>(
474475
let [var_one, var_two] = &adt_def.variants().raw[..] else {
475476
return false;
476477
};
477-
let (([], [field]) | ([field], [])) = (&var_one.fields[..], &var_two.fields[..]) else {
478+
let (([], [field]) | ([field], [])) = (&var_one.fields.raw[..], &var_two.fields.raw[..]) else {
478479
return false;
479480
};
480481
matches!(field.ty(tcx, substs).kind(), ty::FnPtr(..) | ty::Ref(..))
@@ -893,7 +894,7 @@ pub fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: LocalDefId) {
893894
struct_span_err!(tcx.sess, sp, E0075, "SIMD vector cannot be empty").emit();
894895
return;
895896
}
896-
let e = fields[0].ty(tcx, substs);
897+
let e = fields[FieldIdx::from_u32(0)].ty(tcx, substs);
897898
if !fields.iter().all(|f| f.ty(tcx, substs) == e) {
898899
struct_span_err!(tcx.sess, sp, E0076, "SIMD vector should be homogeneous")
899900
.span_label(sp, "SIMD elements must have the same type")

compiler/rustc_hir_analysis/src/check/intrinsicck.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use rustc_middle::ty::{self, Article, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableE
55
use rustc_session::lint;
66
use rustc_span::def_id::LocalDefId;
77
use rustc_span::{Symbol, DUMMY_SP};
8+
use rustc_target::abi::FieldIdx;
89
use rustc_target::asm::{InlineAsmReg, InlineAsmRegClass, InlineAsmRegOrRegClass, InlineAsmType};
910

1011
pub struct InlineAsmCtxt<'a, 'tcx> {
@@ -82,7 +83,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
8283
}
8384
ty::Adt(adt, substs) if adt.repr().simd() => {
8485
let fields = &adt.non_enum_variant().fields;
85-
let elem_ty = fields[0].ty(self.tcx, substs);
86+
let elem_ty = fields[FieldIdx::from_u32(0)].ty(self.tcx, substs);
8687
match elem_ty.kind() {
8788
ty::Never | ty::Error(_) => return None,
8889
ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => {

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ fn check_type_defn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'tcx>, all_sized: b
10301030
// intermediate types must be sized.
10311031
let needs_drop_copy = || {
10321032
packed && {
1033-
let ty = tcx.type_of(variant.fields.last().unwrap().did).subst_identity();
1033+
let ty = tcx.type_of(variant.fields.raw.last().unwrap().did).subst_identity();
10341034
let ty = tcx.erase_regions(ty);
10351035
if ty.needs_infer() {
10361036
tcx.sess
@@ -1046,7 +1046,7 @@ fn check_type_defn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'tcx>, all_sized: b
10461046
let all_sized = all_sized || variant.fields.is_empty() || needs_drop_copy();
10471047
let unsized_len = if all_sized { 0 } else { 1 };
10481048
for (idx, field) in
1049-
variant.fields[..variant.fields.len() - unsized_len].iter().enumerate()
1049+
variant.fields.raw[..variant.fields.len() - unsized_len].iter().enumerate()
10501050
{
10511051
let last = idx == variant.fields.len() - 1;
10521052
let field_id = field.did.expect_local();

compiler/rustc_hir_analysis/src/coherence/builtin.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) -> Coe
486486
// U` can be coerced to `*mut V` if `U: Unsize<V>`.
487487
let fields = &def_a.non_enum_variant().fields;
488488
let diff_fields = fields
489-
.iter()
490-
.enumerate()
489+
.iter_enumerated()
491490
.filter_map(|(i, f)| {
492491
let (a, b) = (f.ty(tcx, substs_a), f.ty(tcx, substs_b));
493492

compiler/rustc_hir_typeck/src/cast.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
103103
Ok(match *t.kind() {
104104
ty::Slice(_) | ty::Str => Some(PointerKind::Length),
105105
ty::Dynamic(ref tty, _, ty::Dyn) => Some(PointerKind::VTable(tty.principal_def_id())),
106-
ty::Adt(def, substs) if def.is_struct() => match def.non_enum_variant().fields.last() {
107-
None => Some(PointerKind::Thin),
108-
Some(f) => {
109-
let field_ty = self.field_ty(span, f, substs);
110-
self.pointer_kind(field_ty, span)?
106+
ty::Adt(def, substs) if def.is_struct() => {
107+
match def.non_enum_variant().fields.raw.last() {
108+
None => Some(PointerKind::Thin),
109+
Some(f) => {
110+
let field_ty = self.field_ty(span, f, substs);
111+
self.pointer_kind(field_ty, span)?
112+
}
111113
}
112-
},
114+
}
113115
ty::Tuple(fields) => match fields.last() {
114116
None => Some(PointerKind::Thin),
115117
Some(&f) => self.pointer_kind(f, span)?,

compiler/rustc_hir_typeck/src/demand.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use rustc_middle::ty::relate::TypeRelation;
1919
use rustc_middle::ty::{self, Article, AssocItem, Ty, TypeAndMut, TypeVisitableExt};
2020
use rustc_span::symbol::{sym, Symbol};
2121
use rustc_span::{BytePos, Span};
22+
use rustc_target::abi::FieldIdx;
2223
use rustc_trait_selection::infer::InferCtxtExt as _;
2324
use rustc_trait_selection::traits::error_reporting::method_chain::CollectAllMismatches;
2425
use rustc_trait_selection::traits::ObligationCause;
@@ -850,7 +851,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
850851
variant.fields.len() == 1
851852
})
852853
.filter_map(|variant| {
853-
let sole_field = &variant.fields[0];
854+
let sole_field = &variant.fields[FieldIdx::from_u32(0)];
854855

855856
let field_is_local = sole_field.did.is_local();
856857
let field_is_accessible =

compiler/rustc_hir_typeck/src/expr.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ use rustc_span::edit_distance::find_best_match_for_name;
5050
use rustc_span::hygiene::DesugaringKind;
5151
use rustc_span::source_map::{Span, Spanned};
5252
use rustc_span::symbol::{kw, sym, Ident, Symbol};
53+
use rustc_target::abi::FieldIdx;
5354
use rustc_target::spec::abi::Abi::RustIntrinsic;
5455
use rustc_trait_selection::infer::InferCtxtExt;
5556
use rustc_trait_selection::traits::{self, ObligationCauseCode};
@@ -1561,8 +1562,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15611562

15621563
let mut remaining_fields = variant
15631564
.fields
1564-
.iter()
1565-
.enumerate()
1565+
.iter_enumerated()
15661566
.map(|(i, field)| (field.ident(tcx).normalize_to_macros_2_0(), (i, field)))
15671567
.collect::<FxHashMap<_, _>>();
15681568

@@ -1815,7 +1815,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18151815
&self,
18161816
adt_ty: Ty<'tcx>,
18171817
span: Span,
1818-
remaining_fields: FxHashMap<Ident, (usize, &ty::FieldDef)>,
1818+
remaining_fields: FxHashMap<Ident, (FieldIdx, &ty::FieldDef)>,
18191819
variant: &'tcx ty::VariantDef,
18201820
ast_fields: &'tcx [hir::ExprField<'tcx>],
18211821
substs: SubstsRef<'tcx>,
@@ -2209,11 +2209,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22092209
let (ident, def_scope) =
22102210
self.tcx.adjust_ident_and_get_scope(field, base_def.did(), body_hir_id);
22112211
let fields = &base_def.non_enum_variant().fields;
2212-
if let Some(index) = fields
2213-
.iter()
2214-
.position(|f| f.ident(self.tcx).normalize_to_macros_2_0() == ident)
2212+
if let Some((index, field)) = fields
2213+
.iter_enumerated()
2214+
.find(|(_, f)| f.ident(self.tcx).normalize_to_macros_2_0() == ident)
22152215
{
2216-
let field = &fields[index];
22172216
let field_ty = self.field_ty(expr.span, field, substs);
22182217
// Save the index of all fields regardless of their visibility in case
22192218
// of error recovery.
@@ -2230,15 +2229,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
22302229
}
22312230
}
22322231
ty::Tuple(tys) => {
2233-
let fstr = field.as_str();
2234-
if let Ok(index) = fstr.parse::<usize>() {
2235-
if fstr == index.to_string() {
2232+
if let Ok(index) = field.as_str().parse::<usize>() {
2233+
if field.name == sym::integer(index) {
22362234
if let Some(&field_ty) = tys.get(index) {
22372235
let adjustments = self.adjust_steps(&autoderef);
22382236
self.apply_adjustments(base, adjustments);
22392237
self.register_predicates(autoderef.into_obligations());
22402238

2241-
self.write_field_index(expr.hir_id, index);
2239+
self.write_field_index(expr.hir_id, FieldIdx::from_usize(index));
22422240
return field_ty;
22432241
}
22442242
}

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
539539
match with_place.place.ty().kind() {
540540
ty::Adt(adt, substs) if adt.is_struct() => {
541541
// Consume those fields of the with expression that are needed.
542-
for (f_index, with_field) in adt.non_enum_variant().fields.iter().enumerate() {
542+
for (f_index, with_field) in adt.non_enum_variant().fields.iter_enumerated() {
543543
let is_mentioned = fields
544544
.iter()
545545
.any(|f| self.mc.typeck_results.opt_field_index(f.hir_id) == Some(f_index));
@@ -548,7 +548,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
548548
&*with_expr,
549549
with_place.clone(),
550550
with_field.ty(self.tcx(), substs),
551-
ProjectionKind::Field(f_index as u32, FIRST_VARIANT),
551+
ProjectionKind::Field(f_index, FIRST_VARIANT),
552552
);
553553
self.delegate_consume(&field_place, field_place.hir_id);
554554
}

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use rustc_span::def_id::LocalDefId;
3333
use rustc_span::hygiene::DesugaringKind;
3434
use rustc_span::symbol::{kw, sym, Ident};
3535
use rustc_span::Span;
36+
use rustc_target::abi::FieldIdx;
3637
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
3738
use rustc_trait_selection::traits::{self, NormalizeExt, ObligationCauseCode, ObligationCtxt};
3839

@@ -147,7 +148,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
147148
}
148149
}
149150

150-
pub fn write_field_index(&self, hir_id: hir::HirId, index: usize) {
151+
pub fn write_field_index(&self, hir_id: hir::HirId, index: FieldIdx) {
151152
self.typeck_results.borrow_mut().field_indices_mut().insert(hir_id, index);
152153
}
153154

compiler/rustc_hir_typeck/src/intrinsicck.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_hir as hir;
44
use rustc_index::vec::Idx;
55
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
66
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
7-
use rustc_target::abi::{Pointer, VariantIdx};
7+
use rustc_target::abi::{FieldIdx, Pointer, VariantIdx};
88

99
use super::FnCtxt;
1010

@@ -28,7 +28,7 @@ fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
2828
}
2929

3030
if def.variant(data_idx).fields.len() == 1 {
31-
return def.variant(data_idx).fields[0].ty(tcx, substs);
31+
return def.variant(data_idx).fields[FieldIdx::from_u32(0)].ty(tcx, substs);
3232
}
3333
}
3434

compiler/rustc_hir_typeck/src/mem_categorization.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use rustc_hir::pat_util::EnumerateAndAdjustIterator;
6161
use rustc_hir::PatKind;
6262
use rustc_infer::infer::InferCtxt;
6363
use rustc_span::Span;
64-
use rustc_target::abi::{VariantIdx, FIRST_VARIANT};
64+
use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
6565
use rustc_trait_selection::infer::InferCtxtExt;
6666

6767
pub(crate) trait HirNode {
@@ -330,7 +330,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
330330
expr,
331331
base,
332332
expr_ty,
333-
ProjectionKind::Field(field_idx as u32, FIRST_VARIANT),
333+
ProjectionKind::Field(field_idx, FIRST_VARIANT),
334334
))
335335
}
336336

@@ -674,7 +674,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
674674

675675
for (i, subpat) in subpats.iter().enumerate_and_adjust(total_fields, dots_pos) {
676676
let subpat_ty = self.pat_ty_adjusted(subpat)?;
677-
let projection_kind = ProjectionKind::Field(i as u32, FIRST_VARIANT);
677+
let projection_kind =
678+
ProjectionKind::Field(FieldIdx::from_usize(i), FIRST_VARIANT);
678679
let sub_place =
679680
self.cat_projection(pat, place_with_id.clone(), subpat_ty, projection_kind);
680681
self.cat_pattern_(sub_place, subpat, op)?;
@@ -689,7 +690,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
689690

690691
for (i, subpat) in subpats.iter().enumerate_and_adjust(total_fields, dots_pos) {
691692
let subpat_ty = self.pat_ty_adjusted(subpat)?;
692-
let projection_kind = ProjectionKind::Field(i as u32, variant_index);
693+
let projection_kind =
694+
ProjectionKind::Field(FieldIdx::from_usize(i), variant_index);
693695
let sub_place =
694696
self.cat_projection(pat, place_with_id.clone(), subpat_ty, projection_kind);
695697
self.cat_pattern_(sub_place, subpat, op)?;
@@ -714,7 +716,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
714716
pat,
715717
place_with_id.clone(),
716718
field_ty,
717-
ProjectionKind::Field(field_index as u32, variant_index),
719+
ProjectionKind::Field(field_index, variant_index),
718720
);
719721
self.cat_pattern_(field_place, fp.pat, op)?;
720722
}

compiler/rustc_hir_typeck/src/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18151815
.variants()
18161816
.iter()
18171817
.flat_map(|variant| {
1818-
let [field] = &variant.fields[..] else { return None; };
1818+
let [field] = &variant.fields.raw[..] else { return None; };
18191819
let field_ty = field.ty(tcx, substs);
18201820

18211821
// Skip `_`, since that'll just lead to ambiguity.

0 commit comments

Comments
 (0)