]> git.lizzy.rs Git - rust.git/commitdiff
Cache the specialization_graph query
authorWesley Wiser <wwiser@gmail.com>
Wed, 14 Mar 2018 01:36:49 +0000 (21:36 -0400)
committerWesley Wiser <wwiser@gmail.com>
Thu, 15 Mar 2018 01:01:31 +0000 (21:01 -0400)
Fixes #48987

src/librustc/traits/specialize/specialization_graph.rs
src/librustc/ty/fast_reject.rs
src/librustc/ty/maps/config.rs
src/librustc/ty/maps/on_disk_cache.rs
src/librustc/ty/maps/plumbing.rs

index f8b895177f381dfa74c02ca0341ceabcde309361..e0d662657b7de60574a69a9bf59ecbcb60bdde54 100644 (file)
@@ -36,6 +36,7 @@
 ///   parents of a given specializing impl, which is needed for extracting
 ///   default items amongst other things. In the simple "chain" rule, every impl
 ///   has at most one parent.
+#[derive(RustcEncodable, RustcDecodable)]
 pub struct Graph {
     // all impls have a parent; the "root" impls have as their parent the def_id
     // of the trait
@@ -47,6 +48,7 @@ pub struct Graph {
 
 /// Children of a given impl, grouped into blanket/non-blanket varieties as is
 /// done in `TraitDef`.
+#[derive(RustcEncodable, RustcDecodable)]
 struct Children {
     // Impls of a trait (or specializations of a given impl). To allow for
     // quicker lookup, the impls are indexed by a simplified version of their
index 93d8a4d979de6d1b020ff0e273f7af0ba130fce9..889648a46be12fe65dccc353afe01c4e2719bf1c 100644 (file)
@@ -28,7 +28,7 @@
 /// because we sometimes need to use SimplifiedTypeGen values as stable sorting
 /// keys (in which case we use a DefPathHash as id-type) but in the general case
 /// the non-stable but fast to construct DefId-version is the better choice.
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, RustcEncodable, RustcDecodable)]
 pub enum SimplifiedTypeGen<D>
     where D: Copy + Debug + Ord + Eq + Hash
 {
index 11675f542873d262ac7d1aa833b09b6e1608406d..008e3b7d859696b11d9cb473d1578f520741f49c 100644 (file)
@@ -721,3 +721,4 @@ fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 impl_disk_cacheable_query!(predicates_of, |def_id| def_id.is_local());
 impl_disk_cacheable_query!(used_trait_imports, |def_id| def_id.is_local());
 impl_disk_cacheable_query!(trans_fn_attrs, |_| true);
+impl_disk_cacheable_query!(specialization_graph_of, |_| true);
index 35e874b74d9ae3a70dc93078d92c098da4b8e860..e7dd4c82254c0c9255eb76e42e7df54bb2d377c8 100644 (file)
@@ -221,6 +221,7 @@ pub fn serialize<'a, 'tcx, E>(&self,
                 encode_query_results::<symbol_name, _>(tcx, enc, qri)?;
                 encode_query_results::<check_match, _>(tcx, enc, qri)?;
                 encode_query_results::<trans_fn_attrs, _>(tcx, enc, qri)?;
+                encode_query_results::<specialization_graph_of, _>(tcx, enc, qri)?;
 
                 // const eval is special, it only encodes successfully evaluated constants
                 use ty::maps::plumbing::GetCacheInternal;
index bc7186f781a82498053208d8ca352be178276306..0bff13a71e39d2de2349052639be1a743e5474e9 100644 (file)
@@ -1001,4 +1001,5 @@ pub fn load_from_on_disk_cache(&self, tcx: TyCtxt) {
     PredicatesOfItem => predicates_of,
     UsedTraitImports => used_trait_imports,
     TransFnAttrs => trans_fn_attrs,
+    SpecializationGraph => specialization_graph_of,
 );