]> git.lizzy.rs Git - rust.git/commitdiff
Fix incremental compilation.
authorCamille GILLOT <gillot.camille@gmail.com>
Fri, 3 Apr 2020 07:49:21 +0000 (09:49 +0200)
committerCamille GILLOT <gillot.camille@gmail.com>
Tue, 28 Apr 2020 09:38:32 +0000 (11:38 +0200)
src/librustc_metadata/rmeta/decoder.rs
src/librustc_middle/arena.rs
src/librustc_middle/query/mod.rs
src/librustc_middle/ty/context.rs
src/librustc_typeck/collect.rs

index dbfa675e0117d7a206c93e57d05be14f5f0353d8..6a4b35ed3d7facd69f6cc74f62cc50b4be211d52 100644 (file)
@@ -798,7 +798,7 @@ fn get_variant(
         )
     }
 
-    fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx>) -> ty::AdtDef {
+    fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx>) -> &'tcx ty::AdtDef {
         let kind = self.kind(item_id);
         let did = self.local_def_id(item_id);
 
index 6692600a093aa9362cfe1081d61e2378b7aeb350..bbeacbfc5382e6005fbf3bf74b8a24782cf885b8 100644 (file)
@@ -12,8 +12,11 @@ macro_rules! arena_types {
     ($macro:path, $args:tt, $tcx:lifetime) => (
         $macro!($args, [
             [] layouts: rustc_target::abi::Layout,
+            // AdtDef are interned and compared by address
+            [] adt_def: rustc_middle::ty::AdtDef,
             [decode] tables: rustc_middle::ty::TypeckTables<$tcx>,
             [] const_allocs: rustc_middle::mir::interpret::Allocation,
+            // Required for the incremental on-disk cache
             [few, decode] mir_keys: rustc_hir::def_id::DefIdSet,
             [] region_scope_tree: rustc_middle::middle::region::ScopeTree,
             [] dropck_outlives:
index 44db95c406449532a97a9a2fcce1646355fb83a7..62a759f29bc9ebe9eaec9249823ca2e5fec946c0 100644 (file)
@@ -282,8 +282,7 @@ fn describe_as_module(def_id: DefId, tcx: TyCtxt<'_>) -> String {
         query trait_def(_: DefId) -> ty::TraitDef {
             storage(ArenaCacheSelector<'tcx>)
         }
-        query adt_def(_: DefId) -> ty::AdtDef {
-            storage(ArenaCacheSelector<'tcx>)
+        query adt_def(_: DefId) -> &'tcx ty::AdtDef {
         }
         query adt_destructor(_: DefId) -> Option<ty::Destructor> {}
 
index 118c692ca77061a449240ce810f18aa2d0a7d387..ae06008d0f9f694c132f7bb3fa89b33dae060749 100644 (file)
@@ -1008,8 +1008,8 @@ pub fn alloc_adt_def(
         kind: AdtKind,
         variants: IndexVec<VariantIdx, ty::VariantDef>,
         repr: ReprOptions,
-    ) -> ty::AdtDef {
-        ty::AdtDef::new(self, did, kind, variants, repr)
+    ) -> &'tcx ty::AdtDef {
+        self.arena.alloc(ty::AdtDef::new(self, did, kind, variants, repr))
     }
 
     pub fn intern_const_alloc(self, alloc: Allocation) -> &'tcx Allocation {
index b95b5fde4f0279519292cc284d63543cdf94ea82..e6aa53dd4f3b7695396b5caee31e4464f8e0dcef 100644 (file)
@@ -861,7 +861,7 @@ fn convert_variant(
     )
 }
 
-fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> ty::AdtDef {
+fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef {
     use rustc_hir::*;
 
     let def_id = def_id.expect_local();