1010
1111use llvm;
1212use llvm:: { ContextRef , ModuleRef , ValueRef } ;
13- use rustc:: dep_graph:: { DepGraph , DepGraphSafe , DepNode , DepTrackingMap , DepTrackingMapConfig } ;
13+ use rustc:: dep_graph:: { DepGraph , DepGraphSafe } ;
1414use rustc:: hir;
1515use rustc:: hir:: def_id:: DefId ;
1616use rustc:: traits;
@@ -34,7 +34,6 @@ use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
3434
3535use std:: ffi:: { CStr , CString } ;
3636use std:: cell:: { Cell , RefCell } ;
37- use std:: marker:: PhantomData ;
3837use std:: ptr;
3938use std:: iter;
4039use std:: str;
@@ -84,9 +83,6 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> {
8483 check_overflow : bool ,
8584
8685 use_dll_storage_attrs : bool ,
87-
88- trait_cache : RefCell < DepTrackingMap < TraitSelectionCache < ' tcx > > > ,
89- project_cache : RefCell < DepTrackingMap < ProjectionCache < ' tcx > > > ,
9086}
9187
9288/// The local portion of a `CrateContext`. There is one `LocalCrateContext`
@@ -171,56 +167,6 @@ pub struct LocalCrateContext<'a, 'tcx: 'a> {
171167 symbol_cache : & ' a SymbolCache < ' a , ' tcx > ,
172168}
173169
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-
224170/// A CrateContext value binds together one LocalCrateContext with the
225171/// SharedCrateContext. It exists as a convenience wrapper, so we don't have to
226172/// pass around (SharedCrateContext, LocalCrateContext) tuples all over trans.
@@ -382,8 +328,6 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
382328 tcx : tcx,
383329 check_overflow : check_overflow,
384330 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 ( ) ) ) ,
387331 }
388332 }
389333
@@ -403,14 +347,6 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
403347 & self . exported_symbols
404348 }
405349
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-
414350 pub fn tcx < ' a > ( & ' a self ) -> TyCtxt < ' a , ' tcx , ' tcx > {
415351 self . tcx
416352 }
0 commit comments