use dep-graph reads for the evaluation cache

This is just duplicating the logic from the old fulfillment cache, so
I'm not sure it is 100% correct, but it should not be more wrong than
the old logic.
This commit is contained in:
Ariel Ben-Yehuda 2017-06-26 18:39:52 +03:00 committed by Niko Matsakis
parent 14875fd3b7
commit 16d1700337

View file

@ -791,6 +791,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
if self.can_use_global_caches(param_env) {
let cache = self.tcx().evaluation_cache.hashmap.borrow();
if let Some(cached) = cache.get(&trait_ref) {
let dep_node = trait_ref
.to_poly_trait_predicate()
.dep_node(self.tcx());
self.tcx().hir.dep_graph.read(dep_node);
return Some(cached.clone());
}
}