diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-08-10 14:35:45 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-08-17 07:51:12 -0400 |
| commit | 25bb51d98fee9d991c06169784a48e4533fff035 (patch) | |
| tree | 2128b25289f80fa9954be4edd3a3d22f917a8576 | |
| parent | 85ac63e9ec9b61bec8584b9df3a67aa504eb1076 (diff) | |
store ecx, not dep-graph
| -rw-r--r-- | src/librustc_metadata/index_builder.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index b7af35da751..0f52252c6a0 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<XRef<'tcx>, 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 { |
