diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index b7af35da751d..0f52252c6a00 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -17,7 +17,7 @@ use rustc::ty; use rustc_data_structures::fnv::FnvHashMap; pub struct IndexBuilder<'a, 'tcx> { - dep_graph: &'a DepGraph, + ecx: &'a EncodeContext<'a, 'tcx>, items: IndexData, xrefs: FnvHashMap, u32>, // sequentially-assigned } @@ -29,12 +29,16 @@ pub enum XRef<'tcx> { Predicate(ty::Predicate<'tcx>) } impl<'a, 'tcx> IndexBuilder<'a, 'tcx> { pub fn new(ecx: &EncodeContext<'a, 'tcx>) -> Self { IndexBuilder { - dep_graph: &ecx.tcx.dep_graph, + ecx: ecx, items: IndexData::new(ecx.tcx.map.num_local_def_ids()), xrefs: FnvHashMap() } } + pub fn ecx(&self) { + self.ecx + } + /// Records that `id` is being emitted at the current offset. /// This data is later used to construct the item index in the /// metadata so we can quickly find the data for a given item. @@ -44,7 +48,7 @@ impl<'a, 'tcx> IndexBuilder<'a, 'tcx> { pub fn record(&mut self, id: DefId, rbml_w: &mut Encoder) -> DepTask<'a> { let position = rbml_w.mark_stable_position(); self.items.record(id, position); - self.dep_graph.in_task(DepNode::MetaData(id)) + self.ecx.tcx.dep_graph.in_task(DepNode::MetaData(id)) } pub fn add_xref(&mut self, xref: XRef<'tcx>) -> u32 {