diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 2f05a37986d..ca1c30def7a 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2997,7 +2997,7 @@ pub struct UnsafetyCheckResult { /// The layout of generator state #[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct GeneratorLayout<'tcx> { - pub variant_fields: IndexVec>>, + pub variant_fields: IndexVec>>, } #[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 6f427f29fcc..b09fe827b24 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -1598,7 +1598,7 @@ impl<'tcx> VariantInfo<'tcx> { Some(variant.fields[i].ident.to_string()), VariantInfo::Generator(_, generator_layout, variant_index) => { let variant_decls = &generator_layout.variant_fields[*variant_index]; - variant_decls[i].name.map(|name| name.to_string()) + variant_decls[i.into()].name.map(|name| name.to_string()) } _ => None, }; diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 36db8c0b7ef..d9496c8c20a 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -58,7 +58,7 @@ use rustc::ty::GeneratorSubsts; use rustc::ty::layout::VariantIdx; use rustc::ty::subst::SubstsRef; use rustc_data_structures::fx::FxHashMap; -use rustc_data_structures::indexed_vec::Idx; +use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc_data_structures::bit_set::BitSet; use std::borrow::Cow; use std::iter; @@ -560,7 +560,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }).unzip(); // Put every var in each variant, for now. - let empty_variants = iter::repeat(vec![]).take(3); + let empty_variants = iter::repeat(IndexVec::new()).take(3); let state_variants = iter::repeat(vars).take(suspending_blocks.count()); let layout = GeneratorLayout { variant_fields: empty_variants.chain(state_variants).collect()