@@ -20,6 +20,7 @@ use middle::lang_items;
20
20
use rustc:: ty:: { self , Ty , TyCtxt , VariantKind } ;
21
21
use rustc:: hir:: def_id:: { DefId , DefIndex , CRATE_DEF_INDEX } ;
22
22
23
+ use rustc:: dep_graph:: DepNode ;
23
24
use rustc:: hir:: map as hir_map;
24
25
use rustc:: mir:: repr:: Mir ;
25
26
use rustc:: mir:: mir_map:: MirMap ;
@@ -37,106 +38,120 @@ use rustc_back::target::Target;
37
38
use rustc:: hir;
38
39
39
40
impl < ' 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 ) ) ;
42
43
let cdata = self . get_crate_data ( def. krate ) ;
43
44
decoder:: get_stability ( & cdata, def. index )
44
45
}
45
46
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 ) ) ;
48
49
let cdata = self . get_crate_data ( def. krate ) ;
49
50
decoder:: get_deprecation ( & cdata, def. index )
50
51
}
51
52
52
53
fn visibility ( & self , def : DefId ) -> ty:: Visibility {
54
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
53
55
let cdata = self . get_crate_data ( def. krate ) ;
54
56
decoder:: get_visibility ( & cdata, def. index )
55
57
}
56
58
57
59
fn closure_kind ( & self , def_id : DefId ) -> ty:: ClosureKind
58
60
{
59
61
assert ! ( !def_id. is_local( ) ) ;
62
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
60
63
let cdata = self . get_crate_data ( def_id. krate ) ;
61
64
decoder:: closure_kind ( & cdata, def_id. index )
62
65
}
63
66
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 > {
66
68
assert ! ( !def_id. is_local( ) ) ;
69
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
67
70
let cdata = self . get_crate_data ( def_id. krate ) ;
68
71
decoder:: closure_ty ( & cdata, def_id. index , tcx)
69
72
}
70
73
71
74
fn item_variances ( & self , def : DefId ) -> ty:: ItemVariances {
75
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
72
76
let cdata = self . get_crate_data ( def. krate ) ;
73
77
decoder:: get_item_variances ( & cdata, def. index )
74
78
}
75
79
76
80
fn repr_attrs ( & self , def : DefId ) -> Vec < attr:: ReprAttr > {
81
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
77
82
let cdata = self . get_crate_data ( def. krate ) ;
78
83
decoder:: get_repr_attrs ( & cdata, def. index )
79
84
}
80
85
81
86
fn item_type < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
82
87
-> ty:: TypeScheme < ' tcx >
83
88
{
89
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
84
90
let cdata = self . get_crate_data ( def. krate ) ;
85
91
decoder:: get_type ( & cdata, def. index , tcx)
86
92
}
87
93
88
94
fn item_predicates < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
89
95
-> ty:: GenericPredicates < ' tcx >
90
96
{
97
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
91
98
let cdata = self . get_crate_data ( def. krate ) ;
92
99
decoder:: get_predicates ( & cdata, def. index , tcx)
93
100
}
94
101
95
102
fn item_super_predicates < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
96
103
-> ty:: GenericPredicates < ' tcx >
97
104
{
105
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
98
106
let cdata = self . get_crate_data ( def. krate ) ;
99
107
decoder:: get_super_predicates ( & cdata, def. index , tcx)
100
108
}
101
109
102
110
fn item_attrs ( & self , def_id : DefId ) -> Vec < ast:: Attribute >
103
111
{
112
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
104
113
let cdata = self . get_crate_data ( def_id. krate ) ;
105
114
decoder:: get_item_attrs ( & cdata, def_id. index )
106
115
}
107
116
108
117
fn item_symbol ( & self , def : DefId ) -> String
109
118
{
119
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
110
120
let cdata = self . get_crate_data ( def. krate ) ;
111
121
decoder:: get_symbol ( & cdata, def. index )
112
122
}
113
123
114
124
fn trait_def < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId ) -> ty:: TraitDef < ' tcx >
115
125
{
126
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
116
127
let cdata = self . get_crate_data ( def. krate ) ;
117
128
decoder:: get_trait_def ( & cdata, def. index , tcx)
118
129
}
119
130
120
131
fn adt_def < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId ) -> ty:: AdtDefMaster < ' tcx >
121
132
{
133
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
122
134
let cdata = self . get_crate_data ( def. krate ) ;
123
135
decoder:: get_adt_def ( & self . intr , & cdata, def. index , tcx)
124
136
}
125
137
126
138
fn method_arg_names ( & self , did : DefId ) -> Vec < String >
127
139
{
140
+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
128
141
let cdata = self . get_crate_data ( did. krate ) ;
129
142
decoder:: get_method_arg_names ( & cdata, did. index )
130
143
}
131
144
132
145
fn item_name ( & self , def : DefId ) -> ast:: Name {
146
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
133
147
let cdata = self . get_crate_data ( def. krate ) ;
134
148
decoder:: get_item_name ( & self . intr , & cdata, def. index )
135
149
}
136
150
137
151
138
152
fn inherent_implementations_for_type ( & self , def_id : DefId ) -> Vec < DefId >
139
153
{
154
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
140
155
let mut result = vec ! [ ] ;
141
156
let cdata = self . get_crate_data ( def_id. krate ) ;
142
157
decoder:: each_inherent_implementation_for_type ( & cdata, def_id. index ,
@@ -146,6 +161,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
146
161
147
162
fn implementations_of_trait ( & self , def_id : DefId ) -> Vec < DefId >
148
163
{
164
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
149
165
let mut result = vec ! [ ] ;
150
166
self . iter_crate_data ( |_, cdata| {
151
167
decoder:: each_implementation_for_trait ( cdata, def_id, & mut |iid| {
@@ -158,64 +174,74 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
158
174
fn provided_trait_methods < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
159
175
-> Vec < Rc < ty:: Method < ' tcx > > >
160
176
{
177
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
161
178
let cdata = self . get_crate_data ( def. krate ) ;
162
179
decoder:: get_provided_trait_methods ( self . intr . clone ( ) , & cdata, def. index , tcx)
163
180
}
164
181
165
182
fn trait_item_def_ids ( & self , def : DefId )
166
183
-> Vec < ty:: ImplOrTraitItemId >
167
184
{
185
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
168
186
let cdata = self . get_crate_data ( def. krate ) ;
169
187
decoder:: get_trait_item_def_ids ( & cdata, def. index )
170
188
}
171
189
172
190
fn impl_items ( & self , impl_def_id : DefId ) -> Vec < ty:: ImplOrTraitItemId >
173
191
{
192
+ self . dep_graph . read ( DepNode :: MetaData ( impl_def_id) ) ;
174
193
let cdata = self . get_crate_data ( impl_def_id. krate ) ;
175
194
decoder:: get_impl_items ( & cdata, impl_def_id. index )
176
195
}
177
196
178
197
fn impl_polarity ( & self , def : DefId ) -> Option < hir:: ImplPolarity >
179
198
{
199
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
180
200
let cdata = self . get_crate_data ( def. krate ) ;
181
201
decoder:: get_impl_polarity ( & cdata, def. index )
182
202
}
183
203
184
204
fn impl_trait_ref < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
185
205
-> Option < ty:: TraitRef < ' tcx > >
186
206
{
207
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
187
208
let cdata = self . get_crate_data ( def. krate ) ;
188
209
decoder:: get_impl_trait ( & cdata, def. index , tcx)
189
210
}
190
211
191
212
fn custom_coerce_unsized_kind ( & self , def : DefId )
192
213
-> Option < ty:: adjustment:: CustomCoerceUnsized >
193
214
{
215
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
194
216
let cdata = self . get_crate_data ( def. krate ) ;
195
217
decoder:: get_custom_coerce_unsized_kind ( & cdata, def. index )
196
218
}
197
219
198
220
// FIXME: killme
199
221
fn associated_consts < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
200
222
-> Vec < Rc < ty:: AssociatedConst < ' tcx > > > {
223
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
201
224
let cdata = self . get_crate_data ( def. krate ) ;
202
225
decoder:: get_associated_consts ( self . intr . clone ( ) , & cdata, def. index , tcx)
203
226
}
204
227
205
228
fn impl_parent ( & self , impl_def : DefId ) -> Option < DefId > {
229
+ self . dep_graph . read ( DepNode :: MetaData ( impl_def) ) ;
206
230
let cdata = self . get_crate_data ( impl_def. krate ) ;
207
231
decoder:: get_parent_impl ( & * cdata, impl_def. index )
208
232
}
209
233
210
234
fn trait_of_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def_id : DefId ) -> Option < DefId >
211
235
{
236
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
212
237
let cdata = self . get_crate_data ( def_id. krate ) ;
213
238
decoder:: get_trait_of_item ( & cdata, def_id. index , tcx)
214
239
}
215
240
216
241
fn impl_or_trait_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
217
242
-> Option < ty:: ImplOrTraitItem < ' tcx > >
218
243
{
244
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
219
245
let cdata = self . get_crate_data ( def. krate ) ;
220
246
decoder:: get_impl_or_trait_item (
221
247
self . intr . clone ( ) ,
@@ -226,34 +252,40 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
226
252
227
253
fn is_const_fn ( & self , did : DefId ) -> bool
228
254
{
255
+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
229
256
let cdata = self . get_crate_data ( did. krate ) ;
230
257
decoder:: is_const_fn ( & cdata, did. index )
231
258
}
232
259
233
260
fn is_defaulted_trait ( & self , trait_def_id : DefId ) -> bool
234
261
{
262
+ self . dep_graph . read ( DepNode :: MetaData ( trait_def_id) ) ;
235
263
let cdata = self . get_crate_data ( trait_def_id. krate ) ;
236
264
decoder:: is_defaulted_trait ( & cdata, trait_def_id. index )
237
265
}
238
266
239
267
fn is_impl ( & self , did : DefId ) -> bool
240
268
{
269
+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
241
270
let cdata = self . get_crate_data ( did. krate ) ;
242
271
decoder:: is_impl ( & cdata, did. index )
243
272
}
244
273
245
274
fn is_default_impl ( & self , impl_did : DefId ) -> bool {
275
+ self . dep_graph . read ( DepNode :: MetaData ( impl_did) ) ;
246
276
let cdata = self . get_crate_data ( impl_did. krate ) ;
247
277
decoder:: is_default_impl ( & cdata, impl_did. index )
248
278
}
249
279
250
280
fn is_extern_item < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , did : DefId ) -> bool {
281
+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
251
282
let cdata = self . get_crate_data ( did. krate ) ;
252
283
decoder:: is_extern_item ( & cdata, did. index , tcx)
253
284
}
254
285
255
286
fn is_static_method ( & self , def : DefId ) -> bool
256
287
{
288
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
257
289
let cdata = self . get_crate_data ( def. krate ) ;
258
290
decoder:: is_static_method ( & cdata, def. index )
259
291
}
@@ -264,6 +296,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
264
296
}
265
297
266
298
fn is_typedef ( & self , did : DefId ) -> bool {
299
+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
267
300
let cdata = self . get_crate_data ( did. krate ) ;
268
301
decoder:: is_typedef ( & cdata, did. index )
269
302
}
@@ -379,40 +412,47 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
379
412
/// parent `DefId` as well as some idea of what kind of data the
380
413
/// `DefId` refers to.
381
414
fn def_key ( & self , def : DefId ) -> hir_map:: DefKey {
415
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
382
416
let cdata = self . get_crate_data ( def. krate ) ;
383
417
decoder:: def_key ( & cdata, def. index )
384
418
}
385
419
386
420
fn relative_def_path ( & self , def : DefId ) -> hir_map:: DefPath {
421
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
387
422
let cdata = self . get_crate_data ( def. krate ) ;
388
423
decoder:: def_path ( & cdata, def. index )
389
424
}
390
425
391
426
fn variant_kind ( & self , def_id : DefId ) -> Option < VariantKind > {
427
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
392
428
let cdata = self . get_crate_data ( def_id. krate ) ;
393
429
decoder:: get_variant_kind ( & cdata, def_id. index )
394
430
}
395
431
396
432
fn struct_ctor_def_id ( & self , struct_def_id : DefId ) -> Option < DefId >
397
433
{
434
+ self . dep_graph . read ( DepNode :: MetaData ( struct_def_id) ) ;
398
435
let cdata = self . get_crate_data ( struct_def_id. krate ) ;
399
436
decoder:: get_struct_ctor_def_id ( & cdata, struct_def_id. index )
400
437
}
401
438
402
439
fn tuple_struct_definition_if_ctor ( & self , did : DefId ) -> Option < DefId >
403
440
{
441
+ self . dep_graph . read ( DepNode :: MetaData ( did) ) ;
404
442
let cdata = self . get_crate_data ( did. krate ) ;
405
443
decoder:: get_tuple_struct_definition_if_ctor ( & cdata, did. index )
406
444
}
407
445
408
446
fn struct_field_names ( & self , def : DefId ) -> Vec < ast:: Name >
409
447
{
448
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
410
449
let cdata = self . get_crate_data ( def. krate ) ;
411
450
decoder:: get_struct_field_names ( & self . intr , & cdata, def. index )
412
451
}
413
452
414
453
fn item_children ( & self , def_id : DefId ) -> Vec < ChildItem >
415
454
{
455
+ self . dep_graph . read ( DepNode :: MetaData ( def_id) ) ;
416
456
let mut result = vec ! [ ] ;
417
457
let crate_data = self . get_crate_data ( def_id. krate ) ;
418
458
let get_crate_data = |cnum| self . get_crate_data ( cnum) ;
@@ -445,17 +485,20 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
445
485
fn maybe_get_item_ast < ' a > ( & ' tcx self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
446
486
-> FoundAst < ' tcx >
447
487
{
488
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
448
489
let cdata = self . get_crate_data ( def. krate ) ;
449
490
decoder:: maybe_get_item_ast ( & cdata, tcx, def. index )
450
491
}
451
492
452
493
fn maybe_get_item_mir < ' a > ( & self , tcx : TyCtxt < ' a , ' tcx , ' tcx > , def : DefId )
453
494
-> Option < Mir < ' tcx > > {
495
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
454
496
let cdata = self . get_crate_data ( def. krate ) ;
455
497
decoder:: maybe_get_item_mir ( & cdata, tcx, def. index )
456
498
}
457
499
458
500
fn is_item_mir_available ( & self , def : DefId ) -> bool {
501
+ self . dep_graph . read ( DepNode :: MetaData ( def) ) ;
459
502
let cdata = self . get_crate_data ( def. krate ) ;
460
503
decoder:: is_item_mir_available ( & cdata, def. index )
461
504
}
0 commit comments