Skip to content

Commit f7c2f24

Browse files
committed
Make variant_fields inner an IndexVec
1 parent 9ef2c30 commit f7c2f24

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/librustc/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2997,7 +2997,7 @@ pub struct UnsafetyCheckResult {
29972997
/// The layout of generator state
29982998
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
29992999
pub struct GeneratorLayout<'tcx> {
3000-
pub variant_fields: IndexVec<VariantIdx, Vec<LocalDecl<'tcx>>>,
3000+
pub variant_fields: IndexVec<VariantIdx, IndexVec<Field, LocalDecl<'tcx>>>,
30013001
}
30023002

30033003
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]

src/librustc_codegen_llvm/debuginfo/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ impl<'tcx> VariantInfo<'tcx> {
15981598
Some(variant.fields[i].ident.to_string()),
15991599
VariantInfo::Generator(_, generator_layout, variant_index) => {
16001600
let variant_decls = &generator_layout.variant_fields[*variant_index];
1601-
variant_decls[i].name.map(|name| name.to_string())
1601+
variant_decls[i.into()].name.map(|name| name.to_string())
16021602
}
16031603
_ => None,
16041604
};

src/librustc_mir/transform/generator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use rustc::ty::GeneratorSubsts;
5858
use rustc::ty::layout::VariantIdx;
5959
use rustc::ty::subst::SubstsRef;
6060
use rustc_data_structures::fx::FxHashMap;
61-
use rustc_data_structures::indexed_vec::Idx;
61+
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
6262
use rustc_data_structures::bit_set::BitSet;
6363
use std::borrow::Cow;
6464
use std::iter;
@@ -560,7 +560,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
560560
}).unzip();
561561

562562
// Put every var in each variant, for now.
563-
let empty_variants = iter::repeat(vec![]).take(3);
563+
let empty_variants = iter::repeat(IndexVec::new()).take(3);
564564
let state_variants = iter::repeat(vars).take(suspending_blocks.count());
565565
let layout = GeneratorLayout {
566566
variant_fields: empty_variants.chain(state_variants).collect()

0 commit comments

Comments
 (0)