10
10
11
11
use llvm;
12
12
use llvm:: { ContextRef , ModuleRef , ValueRef } ;
13
- use rustc:: dep_graph:: { DepGraph , DepGraphSafe , DepNode , DepTrackingMap , DepTrackingMapConfig } ;
13
+ use rustc:: dep_graph:: { DepGraph , DepGraphSafe } ;
14
14
use rustc:: hir;
15
15
use rustc:: hir:: def_id:: DefId ;
16
16
use rustc:: traits;
@@ -34,7 +34,6 @@ use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
34
34
35
35
use std:: ffi:: { CStr , CString } ;
36
36
use std:: cell:: { Cell , RefCell } ;
37
- use std:: marker:: PhantomData ;
38
37
use std:: ptr;
39
38
use std:: iter;
40
39
use std:: str;
@@ -84,9 +83,6 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> {
84
83
check_overflow : bool ,
85
84
86
85
use_dll_storage_attrs : bool ,
87
-
88
- trait_cache : RefCell < DepTrackingMap < TraitSelectionCache < ' tcx > > > ,
89
- project_cache : RefCell < DepTrackingMap < ProjectionCache < ' tcx > > > ,
90
86
}
91
87
92
88
/// The local portion of a `CrateContext`. There is one `LocalCrateContext`
@@ -171,56 +167,6 @@ pub struct LocalCrateContext<'a, 'tcx: 'a> {
171
167
symbol_cache : & ' a SymbolCache < ' a , ' tcx > ,
172
168
}
173
169
174
- // Implement DepTrackingMapConfig for `trait_cache`
175
- pub struct TraitSelectionCache < ' tcx > {
176
- data : PhantomData < & ' tcx ( ) >
177
- }
178
-
179
- impl < ' tcx > DepTrackingMapConfig for TraitSelectionCache < ' tcx > {
180
- type Key = ty:: PolyTraitRef < ' tcx > ;
181
- type Value = traits:: Vtable < ' tcx , ( ) > ;
182
- fn to_dep_node ( key : & ty:: PolyTraitRef < ' tcx > ) -> DepNode < DefId > {
183
- key. to_poly_trait_predicate ( ) . dep_node ( )
184
- }
185
- }
186
-
187
- // # Global Cache
188
-
189
- pub struct ProjectionCache < ' gcx > {
190
- data : PhantomData < & ' gcx ( ) >
191
- }
192
-
193
- impl < ' gcx > DepTrackingMapConfig for ProjectionCache < ' gcx > {
194
- type Key = Ty < ' gcx > ;
195
- type Value = Ty < ' gcx > ;
196
- fn to_dep_node ( key : & Self :: Key ) -> DepNode < DefId > {
197
- // Ideally, we'd just put `key` into the dep-node, but we
198
- // can't put full types in there. So just collect up all the
199
- // def-ids of structs/enums as well as any traits that we
200
- // project out of. It doesn't matter so much what we do here,
201
- // except that if we are too coarse, we'll create overly
202
- // coarse edges between impls and the trans. For example, if
203
- // we just used the def-id of things we are projecting out of,
204
- // then the key for `<Foo as SomeTrait>::T` and `<Bar as
205
- // SomeTrait>::T` would both share a dep-node
206
- // (`TraitSelect(SomeTrait)`), and hence the impls for both
207
- // `Foo` and `Bar` would be considered inputs. So a change to
208
- // `Bar` would affect things that just normalized `Foo`.
209
- // Anyway, this heuristic is not ideal, but better than
210
- // nothing.
211
- let def_ids: Vec < DefId > =
212
- key. walk ( )
213
- . filter_map ( |t| match t. sty {
214
- ty:: TyAdt ( adt_def, _) => Some ( adt_def. did ) ,
215
- ty:: TyProjection ( ref proj) => Some ( proj. trait_ref . def_id ) ,
216
- _ => None ,
217
- } )
218
- . collect ( ) ;
219
-
220
- DepNode :: ProjectionCache { def_ids : def_ids }
221
- }
222
- }
223
-
224
170
/// A CrateContext value binds together one LocalCrateContext with the
225
171
/// SharedCrateContext. It exists as a convenience wrapper, so we don't have to
226
172
/// pass around (SharedCrateContext, LocalCrateContext) tuples all over trans.
@@ -382,8 +328,6 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
382
328
tcx : tcx,
383
329
check_overflow : check_overflow,
384
330
use_dll_storage_attrs : use_dll_storage_attrs,
385
- trait_cache : RefCell :: new ( DepTrackingMap :: new ( tcx. dep_graph . clone ( ) ) ) ,
386
- project_cache : RefCell :: new ( DepTrackingMap :: new ( tcx. dep_graph . clone ( ) ) ) ,
387
331
}
388
332
}
389
333
@@ -403,14 +347,6 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
403
347
& self . exported_symbols
404
348
}
405
349
406
- pub fn trait_cache ( & self ) -> & RefCell < DepTrackingMap < TraitSelectionCache < ' tcx > > > {
407
- & self . trait_cache
408
- }
409
-
410
- pub fn project_cache ( & self ) -> & RefCell < DepTrackingMap < ProjectionCache < ' tcx > > > {
411
- & self . project_cache
412
- }
413
-
414
350
pub fn tcx < ' a > ( & ' a self ) -> TyCtxt < ' a , ' tcx , ' tcx > {
415
351
self . tcx
416
352
}
0 commit comments