@@ -20,6 +20,7 @@ use middle::lang_items;
2020use rustc:: ty:: { self , Ty , TyCtxt , VariantKind } ;
2121use rustc:: hir:: def_id:: { DefId , DefIndex , CRATE_DEF_INDEX } ;
2222
23+ use rustc:: dep_graph:: DepNode ;
2324use rustc:: hir:: map as hir_map;
2425use rustc:: mir:: repr:: Mir ;
2526use rustc:: mir:: mir_map:: MirMap ;
@@ -37,106 +38,120 @@ use rustc_back::target::Target;
3738use rustc:: hir;
3839
3940impl < ' tcx > CrateStore < ' tcx > for cstore:: CStore {
40- fn stability ( & self , def : DefId ) -> Option < attr:: Stability >
41- {
41+ fn stability ( & self , def : DefId ) -> Option < attr:: Stability > {
42+ self . dep_graph . read ( DepNode :: MetaData ( def ) ) ;
4243 let cdata = self . get_crate_data ( def. krate ) ;
4344 decoder:: get_stability ( & cdata, def. index )
4445 }
4546
46- fn deprecation ( & self , def : DefId ) -> Option < attr:: Deprecation >
47- {
47+ fn deprecation ( & self , def : DefId ) -> Option < attr:: Deprecation > {
48+ self . dep_graph . read ( DepNode :: MetaData ( def ) ) ;
4849 let cdata = self . get_crate_data ( def. krate ) ;
4950 decoder:: get_deprecation ( & cdata, def. index )
5051 }
5152
5253 fn visibility ( & self , def : DefId ) -> ty:: Visibility {
54+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
5355 let cdata = self . get_crate_data ( def. krate ) ;
5456 decoder:: get_visibility ( & cdata, def. index )
5557 }
5658
5759 fn closure_kind ( & self , def_id : DefId ) -> ty:: ClosureKind
5860 {
5961 assert ! ( !def_id. is_local( ) ) ;
62+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
6063 let cdata = self . get_crate_data ( def_id. krate ) ;
6164 decoder:: closure_kind ( & cdata, def_id. index )
6265 }
6366
64- fn closure_ty < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId ) -> ty:: ClosureTy < ' tcx >
65- {
67+ fn closure_ty ( & self , tcx : & TyCtxt < ' tcx > , def_id : DefId ) -> ty:: ClosureTy < ' tcx > {
6668 assert ! ( !def_id. is_local( ) ) ;
69+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
6770 let cdata = self . get_crate_data ( def_id. krate ) ;
6871 decoder:: closure_ty ( & cdata, def_id. index , tcx)
6972 }
7073
7174 fn item_variances ( & self , def : DefId ) -> ty:: ItemVariances {
75+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
7276 let cdata = self . get_crate_data ( def. krate ) ;
7377 decoder:: get_item_variances ( & cdata, def. index )
7478 }
7579
7680 fn repr_attrs ( & self , def : DefId ) -> Vec < attr:: ReprAttr > {
81+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
7782 let cdata = self . get_crate_data ( def. krate ) ;
7883 decoder:: get_repr_attrs ( & cdata, def. index )
7984 }
8085
8186 fn item_type < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
8287 -> ty:: TypeScheme < ' tcx >
8388 {
89+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
8490 let cdata = self . get_crate_data ( def. krate ) ;
8591 decoder:: get_type ( & cdata, def. index , tcx)
8692 }
8793
8894 fn item_predicates < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
8995 -> ty:: GenericPredicates < ' tcx >
9096 {
97+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
9198 let cdata = self . get_crate_data ( def. krate ) ;
9299 decoder:: get_predicates ( & cdata, def. index , tcx)
93100 }
94101
95102 fn item_super_predicates < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
96103 -> ty:: GenericPredicates < ' tcx >
97104 {
105+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
98106 let cdata = self . get_crate_data ( def. krate ) ;
99107 decoder:: get_super_predicates ( & cdata, def. index , tcx)
100108 }
101109
102110 fn item_attrs ( & self , def_id : DefId ) -> Vec < ast:: Attribute >
103111 {
112+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
104113 let cdata = self . get_crate_data ( def_id. krate ) ;
105114 decoder:: get_item_attrs ( & cdata, def_id. index )
106115 }
107116
108117 fn item_symbol ( & self , def : DefId ) -> String
109118 {
119+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
110120 let cdata = self . get_crate_data ( def. krate ) ;
111121 decoder:: get_symbol ( & cdata, def. index )
112122 }
113123
114124 fn trait_def < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId ) -> ty:: TraitDef < ' tcx >
115125 {
126+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
116127 let cdata = self . get_crate_data ( def. krate ) ;
117128 decoder:: get_trait_def ( & cdata, def. index , tcx)
118129 }
119130
120131 fn adt_def < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId ) -> ty:: AdtDefMaster < ' tcx >
121132 {
133+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
122134 let cdata = self . get_crate_data ( def. krate ) ;
123135 decoder:: get_adt_def ( & self . intr , & cdata, def. index , tcx)
124136 }
125137
126138 fn method_arg_names ( & self , did : DefId ) -> Vec < String >
127139 {
140+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
128141 let cdata = self . get_crate_data ( did. krate ) ;
129142 decoder:: get_method_arg_names ( & cdata, did. index )
130143 }
131144
132145 fn item_name ( & self , def : DefId ) -> ast:: Name {
146+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
133147 let cdata = self . get_crate_data ( def. krate ) ;
134148 decoder:: get_item_name ( & self . intr , & cdata, def. index )
135149 }
136150
137151
138152 fn inherent_implementations_for_type ( & self , def_id : DefId ) -> Vec < DefId >
139153 {
154+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
140155 let mut result = vec ! [ ] ;
141156 let cdata = self . get_crate_data ( def_id. krate ) ;
142157 decoder:: each_inherent_implementation_for_type ( & cdata, def_id. index ,
@@ -146,6 +161,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
146161
147162 fn implementations_of_trait ( & self , def_id : DefId ) -> Vec < DefId >
148163 {
164+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
149165 let mut result = vec ! [ ] ;
150166 self . iter_crate_data ( |_, cdata| {
151167 decoder:: each_implementation_for_trait ( cdata, def_id, & mut |iid| {
@@ -158,64 +174,74 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
158174 fn provided_trait_methods < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
159175 -> Vec < Rc < ty:: Method < ' tcx > > >
160176 {
177+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
161178 let cdata = self . get_crate_data ( def. krate ) ;
162179 decoder:: get_provided_trait_methods ( self . intr . clone ( ) , & cdata, def. index , tcx)
163180 }
164181
165182 fn trait_item_def_ids ( & self , def : DefId )
166183 -> Vec < ty:: ImplOrTraitItemId >
167184 {
185+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
168186 let cdata = self . get_crate_data ( def. krate ) ;
169187 decoder:: get_trait_item_def_ids ( & cdata, def. index )
170188 }
171189
172190 fn impl_items ( & self , impl_def_id : DefId ) -> Vec < ty:: ImplOrTraitItemId >
173191 {
192+ self . dep_graph . read ( DepNode :: MetaData ( impl_def_id) ) ;
174193 let cdata = self . get_crate_data ( impl_def_id. krate ) ;
175194 decoder:: get_impl_items ( & cdata, impl_def_id. index )
176195 }
177196
178197 fn impl_polarity ( & self , def : DefId ) -> Option < hir:: ImplPolarity >
179198 {
199+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
180200 let cdata = self . get_crate_data ( def. krate ) ;
181201 decoder:: get_impl_polarity ( & cdata, def. index )
182202 }
183203
184204 fn impl_trait_ref < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
185205 -> Option < ty:: TraitRef < ' tcx > >
186206 {
207+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
187208 let cdata = self . get_crate_data ( def. krate ) ;
188209 decoder:: get_impl_trait ( & cdata, def. index , tcx)
189210 }
190211
191212 fn custom_coerce_unsized_kind ( & self , def : DefId )
192213 -> Option < ty:: adjustment:: CustomCoerceUnsized >
193214 {
215+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
194216 let cdata = self . get_crate_data ( def. krate ) ;
195217 decoder:: get_custom_coerce_unsized_kind ( & cdata, def. index )
196218 }
197219
198220 // FIXME: killme
199221 fn associated_consts < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
200222 -> Vec < Rc < ty:: AssociatedConst < ' tcx > > > {
223+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
201224 let cdata = self . get_crate_data ( def. krate ) ;
202225 decoder:: get_associated_consts ( self . intr . clone ( ) , & cdata, def. index , tcx)
203226 }
204227
205228 fn impl_parent ( & self , impl_def : DefId ) -> Option < DefId > {
229+ self . dep_graph . read ( DepNode :: MetaData ( impl_def) ) ;
206230 let cdata = self . get_crate_data ( impl_def. krate ) ;
207231 decoder:: get_parent_impl ( & * cdata, impl_def. index )
208232 }
209233
210234 fn trait_of_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId ) -> Option < DefId >
211235 {
236+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
212237 let cdata = self . get_crate_data ( def_id. krate ) ;
213238 decoder:: get_trait_of_item ( & cdata, def_id. index , tcx)
214239 }
215240
216241 fn impl_or_trait_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
217242 -> Option < ty:: ImplOrTraitItem < ' tcx > >
218243 {
244+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
219245 let cdata = self . get_crate_data ( def. krate ) ;
220246 decoder:: get_impl_or_trait_item (
221247 self . intr . clone ( ) ,
@@ -226,34 +252,40 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
226252
227253 fn is_const_fn ( & self , did : DefId ) -> bool
228254 {
255+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
229256 let cdata = self . get_crate_data ( did. krate ) ;
230257 decoder:: is_const_fn ( & cdata, did. index )
231258 }
232259
233260 fn is_defaulted_trait ( & self , trait_def_id : DefId ) -> bool
234261 {
262+ self . dep_graph . read ( DepNode :: MetaData ( trait_def_id) ) ;
235263 let cdata = self . get_crate_data ( trait_def_id. krate ) ;
236264 decoder:: is_defaulted_trait ( & cdata, trait_def_id. index )
237265 }
238266
239267 fn is_impl ( & self , did : DefId ) -> bool
240268 {
269+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
241270 let cdata = self . get_crate_data ( did. krate ) ;
242271 decoder:: is_impl ( & cdata, did. index )
243272 }
244273
245274 fn is_default_impl ( & self , impl_did : DefId ) -> bool {
275+ self . dep_graph . read ( DepNode :: MetaData ( impl_did) ) ;
246276 let cdata = self . get_crate_data ( impl_did. krate ) ;
247277 decoder:: is_default_impl ( & cdata, impl_did. index )
248278 }
249279
250280 fn is_extern_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , did : DefId ) -> bool {
281+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
251282 let cdata = self . get_crate_data ( did. krate ) ;
252283 decoder:: is_extern_item ( & cdata, did. index , tcx)
253284 }
254285
255286 fn is_static_method ( & self , def : DefId ) -> bool
256287 {
288+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
257289 let cdata = self . get_crate_data ( def. krate ) ;
258290 decoder:: is_static_method ( & cdata, def. index )
259291 }
@@ -264,6 +296,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
264296 }
265297
266298 fn is_typedef ( & self , did : DefId ) -> bool {
299+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
267300 let cdata = self . get_crate_data ( did. krate ) ;
268301 decoder:: is_typedef ( & cdata, did. index )
269302 }
@@ -379,40 +412,47 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
379412 /// parent `DefId` as well as some idea of what kind of data the
380413 /// `DefId` refers to.
381414 fn def_key ( & self , def : DefId ) -> hir_map:: DefKey {
415+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
382416 let cdata = self . get_crate_data ( def. krate ) ;
383417 decoder:: def_key ( & cdata, def. index )
384418 }
385419
386420 fn relative_def_path ( & self , def : DefId ) -> hir_map:: DefPath {
421+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
387422 let cdata = self . get_crate_data ( def. krate ) ;
388423 decoder:: def_path ( & cdata, def. index )
389424 }
390425
391426 fn variant_kind ( & self , def_id : DefId ) -> Option < VariantKind > {
427+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
392428 let cdata = self . get_crate_data ( def_id. krate ) ;
393429 decoder:: get_variant_kind ( & cdata, def_id. index )
394430 }
395431
396432 fn struct_ctor_def_id ( & self , struct_def_id : DefId ) -> Option < DefId >
397433 {
434+ self . dep_graph . read ( DepNode :: MetaData ( struct_def_id) ) ;
398435 let cdata = self . get_crate_data ( struct_def_id. krate ) ;
399436 decoder:: get_struct_ctor_def_id ( & cdata, struct_def_id. index )
400437 }
401438
402439 fn tuple_struct_definition_if_ctor ( & self , did : DefId ) -> Option < DefId >
403440 {
441+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
404442 let cdata = self . get_crate_data ( did. krate ) ;
405443 decoder:: get_tuple_struct_definition_if_ctor ( & cdata, did. index )
406444 }
407445
408446 fn struct_field_names ( & self , def : DefId ) -> Vec < ast:: Name >
409447 {
448+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
410449 let cdata = self . get_crate_data ( def. krate ) ;
411450 decoder:: get_struct_field_names ( & self . intr , & cdata, def. index )
412451 }
413452
414453 fn item_children ( & self , def_id : DefId ) -> Vec < ChildItem >
415454 {
455+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
416456 let mut result = vec ! [ ] ;
417457 let crate_data = self . get_crate_data ( def_id. krate ) ;
418458 let get_crate_data = |cnum| self . get_crate_data ( cnum) ;
@@ -445,17 +485,20 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
445485 fn maybe_get_item_ast < ' a > ( & ' tcx self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
446486 -> FoundAst < ' tcx >
447487 {
488+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
448489 let cdata = self . get_crate_data ( def. krate ) ;
449490 decoder:: maybe_get_item_ast ( & cdata, tcx, def. index )
450491 }
451492
452493 fn maybe_get_item_mir < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
453494 -> Option < Mir < ' tcx > > {
495+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
454496 let cdata = self . get_crate_data ( def. krate ) ;
455497 decoder:: maybe_get_item_mir ( & cdata, tcx, def. index )
456498 }
457499
458500 fn is_item_mir_available ( & self , def : DefId ) -> bool {
501+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
459502 let cdata = self . get_crate_data ( def. krate ) ;
460503 decoder:: is_item_mir_available ( & cdata, def. index )
461504 }
0 commit comments