@@ -17,7 +17,7 @@ use rustc::ty;
17
17
use rustc_data_structures:: fnv:: FnvHashMap ;
18
18
19
19
pub struct IndexBuilder < ' a , ' tcx > {
20
- dep_graph : & ' a DepGraph ,
20
+ ecx : & ' a EncodeContext < ' a , ' tcx > ,
21
21
items : IndexData ,
22
22
xrefs : FnvHashMap < XRef < ' tcx > , u32 > , // sequentially-assigned
23
23
}
@@ -29,12 +29,16 @@ pub enum XRef<'tcx> { Predicate(ty::Predicate<'tcx>) }
29
29
impl < ' a , ' tcx > IndexBuilder < ' a , ' tcx > {
30
30
pub fn new ( ecx : & EncodeContext < ' a , ' tcx > ) -> Self {
31
31
IndexBuilder {
32
- dep_graph : & ecx. tcx . dep_graph ,
32
+ ecx : ecx,
33
33
items : IndexData :: new ( ecx. tcx . map . num_local_def_ids ( ) ) ,
34
34
xrefs : FnvHashMap ( )
35
35
}
36
36
}
37
37
38
+ pub fn ecx ( & self ) {
39
+ self . ecx
40
+ }
41
+
38
42
/// Records that `id` is being emitted at the current offset.
39
43
/// This data is later used to construct the item index in the
40
44
/// metadata so we can quickly find the data for a given item.
@@ -44,7 +48,7 @@ impl<'a, 'tcx> IndexBuilder<'a, 'tcx> {
44
48
pub fn record ( & mut self , id : DefId , rbml_w : & mut Encoder ) -> DepTask < ' a > {
45
49
let position = rbml_w. mark_stable_position ( ) ;
46
50
self . items . record ( id, position) ;
47
- self . dep_graph . in_task ( DepNode :: MetaData ( id) )
51
+ self . ecx . tcx . dep_graph . in_task ( DepNode :: MetaData ( id) )
48
52
}
49
53
50
54
pub fn add_xref ( & mut self , xref : XRef < ' tcx > ) -> u32 {
0 commit comments