store ecx, not dep-graph

This commit is contained in:
Niko Matsakis 2016-08-10 14:35:45 -04:00
parent 85ac63e9ec
commit 25bb51d98f

View file

@ -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 {