about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/ty/maps/config.rs19
-rw-r--r--src/librustc/ty/maps/on_disk_cache.rs1
-rw-r--r--src/librustc/ty/maps/plumbing.rs1
3 files changed, 19 insertions, 2 deletions
diff --git a/src/librustc/ty/maps/config.rs b/src/librustc/ty/maps/config.rs
index 1dad74fb28e..5143654e916 100644
--- a/src/librustc/ty/maps/config.rs
+++ b/src/librustc/ty/maps/config.rs
@@ -617,8 +617,8 @@ impl<'tcx> QueryDescription<'tcx> for queries::optimized_mir<'tcx> {
     }
 
     fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                          id: SerializedDepNodeIndex)
-                          -> Option<Self::Value> {
+                              id: SerializedDepNodeIndex)
+                              -> Option<Self::Value> {
         let mir: Option<::mir::Mir<'tcx>> = tcx.on_disk_query_result_cache
                                                .try_load_query_result(tcx, id);
         mir.map(|x| tcx.alloc_mir(x))
@@ -637,6 +637,21 @@ impl<'tcx> QueryDescription<'tcx> for queries::target_features_whitelist<'tcx> {
     }
 }
 
+impl<'tcx> QueryDescription<'tcx> for queries::generics_of<'tcx> {
+    #[inline]
+    fn cache_on_disk(def_id: Self::Key) -> bool {
+        def_id.is_local()
+    }
+
+    fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+                              id: SerializedDepNodeIndex)
+                              -> Option<Self::Value> {
+        let generics: Option<ty::Generics> = tcx.on_disk_query_result_cache
+                                                .try_load_query_result(tcx, id);
+        generics.map(|x| tcx.alloc_generics(x))
+    }
+}
+
 macro_rules! impl_disk_cacheable_query(
     ($query_name:ident, |$key:tt| $cond:expr) => {
         impl<'tcx> QueryDescription<'tcx> for queries::$query_name<'tcx> {
diff --git a/src/librustc/ty/maps/on_disk_cache.rs b/src/librustc/ty/maps/on_disk_cache.rs
index a489bec5b27..56ed0f9106f 100644
--- a/src/librustc/ty/maps/on_disk_cache.rs
+++ b/src/librustc/ty/maps/on_disk_cache.rs
@@ -205,6 +205,7 @@ impl<'sess> OnDiskCache<'sess> {
                 let qri = &mut query_result_index;
 
                 encode_query_results::<type_of, _>(tcx, enc, qri)?;
+                encode_query_results::<generics_of, _>(tcx, enc, qri)?;
                 encode_query_results::<predicates_of, _>(tcx, enc, qri)?;
                 encode_query_results::<used_trait_imports, _>(tcx, enc, qri)?;
                 encode_query_results::<typeck_tables_of, _>(tcx, enc, qri)?;
diff --git a/src/librustc/ty/maps/plumbing.rs b/src/librustc/ty/maps/plumbing.rs
index a0db3c7bca8..3e1b490957c 100644
--- a/src/librustc/ty/maps/plumbing.rs
+++ b/src/librustc/ty/maps/plumbing.rs
@@ -983,6 +983,7 @@ impl_load_from_cache!(
     ContainsExternIndicator => contains_extern_indicator,
     CheckMatch => check_match,
     TypeOfItem => type_of,
+    GenericsOfItem => generics_of,
     PredicatesOfItem => predicates_of,
     UsedTraitImports => used_trait_imports,
 );