Skip to content

Commit 22c0cbf

Browse files
committed
remove generator_interiors map
1 parent 413f074 commit 22c0cbf

File tree

4 files changed

+5
-40
lines changed

4 files changed

+5
-40
lines changed

src/librustc/ty/context.rs

-23
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,6 @@ pub struct TypeckTables<'tcx> {
360360
/// not all closures are present in the map.
361361
closure_kind_origins: ItemLocalMap<(Span, ast::Name)>,
362362

363-
generator_interiors: ItemLocalMap<ty::GeneratorInterior<'tcx>>,
364-
365363
/// For each fn, records the "liberated" types of its arguments
366364
/// and return type. Liberated means that all bound regions
367365
/// (including late-bound regions) are replaced with free
@@ -406,7 +404,6 @@ impl<'tcx> TypeckTables<'tcx> {
406404
pat_binding_modes: ItemLocalMap(),
407405
pat_adjustments: ItemLocalMap(),
408406
upvar_capture_map: FxHashMap(),
409-
generator_interiors: ItemLocalMap(),
410407
closure_kind_origins: ItemLocalMap(),
411408
liberated_fn_sigs: ItemLocalMap(),
412409
fru_field_types: ItemLocalMap(),
@@ -657,24 +654,6 @@ impl<'tcx> TypeckTables<'tcx> {
657654
data: &mut self.cast_kinds
658655
}
659656
}
660-
661-
pub fn generator_interiors(&self)
662-
-> LocalTableInContext<ty::GeneratorInterior<'tcx>>
663-
{
664-
LocalTableInContext {
665-
local_id_root: self.local_id_root,
666-
data: &self.generator_interiors,
667-
}
668-
}
669-
670-
pub fn generator_interiors_mut(&mut self)
671-
-> LocalTableInContextMut<ty::GeneratorInterior<'tcx>>
672-
{
673-
LocalTableInContextMut {
674-
local_id_root: self.local_id_root,
675-
data: &mut self.generator_interiors,
676-
}
677-
}
678657
}
679658

680659
impl<'gcx> HashStable<StableHashingContext<'gcx>> for TypeckTables<'gcx> {
@@ -699,7 +678,6 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for TypeckTables<'gcx> {
699678
ref used_trait_imports,
700679
tainted_by_errors,
701680
ref free_region_map,
702-
ref generator_interiors,
703681
} = *self;
704682

705683
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
@@ -735,7 +713,6 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for TypeckTables<'gcx> {
735713
liberated_fn_sigs.hash_stable(hcx, hasher);
736714
fru_field_types.hash_stable(hcx, hasher);
737715
cast_kinds.hash_stable(hcx, hasher);
738-
generator_interiors.hash_stable(hcx, hasher);
739716
used_trait_imports.hash_stable(hcx, hasher);
740717
tainted_by_errors.hash_stable(hcx, hasher);
741718
free_region_map.hash_stable(hcx, hasher);

src/librustc_mir/transform/generator.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,11 @@ impl MirPass for StateTransform {
768768
let hir_id = tcx.hir.node_to_hir_id(node_id);
769769

770770
// Get the interior types which typeck computed
771-
let interior = *tcx.typeck_tables_of(def_id).generator_interiors().get(hir_id).unwrap();
771+
let tables = tcx.typeck_tables_of(def_id);
772+
let interior = match tables.node_id_to_type(hir_id).sty {
773+
ty::TyGenerator(_, _, interior) => interior,
774+
ref t => bug!("type of generator not a generator: {:?}", t),
775+
};
772776

773777
// The first argument is the generator type passed by value
774778
let gen_ty = mir.local_decls.raw[1].ty;

src/librustc_typeck/check/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1040,9 +1040,6 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
10401040
let witness = fcx.next_ty_var(TypeVariableOrigin::MiscVariable(span));
10411041
fcx.deferred_generator_interiors.borrow_mut().push((body.id(), witness));
10421042
let interior = ty::GeneratorInterior::new(witness);
1043-
1044-
inherited.tables.borrow_mut().generator_interiors_mut().insert(fn_hir_id, interior);
1045-
10461043
Some(GeneratorTypes { yield_ty: fcx.yield_ty.unwrap(), interior: interior })
10471044
} else {
10481045
None

src/librustc_typeck/check/writeback.rs

-13
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4646
wbcx.visit_anon_types();
4747
wbcx.visit_cast_types();
4848
wbcx.visit_free_region_map();
49-
wbcx.visit_generator_interiors();
5049

5150
let used_trait_imports = mem::replace(&mut self.tables.borrow_mut().used_trait_imports,
5251
Rc::new(DefIdSet()));
@@ -378,18 +377,6 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
378377
}
379378
}
380379

381-
fn visit_generator_interiors(&mut self) {
382-
let common_local_id_root = self.fcx.tables.borrow().local_id_root.unwrap();
383-
for (&id, interior) in self.fcx.tables.borrow().generator_interiors().iter() {
384-
let hir_id = hir::HirId {
385-
owner: common_local_id_root.index,
386-
local_id: id,
387-
};
388-
let interior = self.resolve(interior, &hir_id);
389-
self.tables.generator_interiors_mut().insert(hir_id, interior);
390-
}
391-
}
392-
393380
fn visit_liberated_fn_sigs(&mut self) {
394381
let fcx_tables = self.fcx.tables.borrow();
395382
debug_assert_eq!(fcx_tables.local_id_root, self.tables.local_id_root);

0 commit comments

Comments
 (0)