diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-04-03 09:49:21 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2020-04-28 11:38:32 +0200 |
| commit | bd6187060608f149c16c43b8b5aeb9a52924a2c3 (patch) | |
| tree | f94145c0d1fefae7f8643f1f38f1d5cf56a85ae2 | |
| parent | 0a010b33ffc078db27100d008105cc151e3f3989 (diff) | |
| download | rust-bd6187060608f149c16c43b8b5aeb9a52924a2c3.tar.gz rust-bd6187060608f149c16c43b8b5aeb9a52924a2c3.zip | |
Fix incremental compilation.
| -rw-r--r-- | src/librustc_metadata/rmeta/decoder.rs | 2 | ||||
| -rw-r--r-- | src/librustc_middle/arena.rs | 3 | ||||
| -rw-r--r-- | src/librustc_middle/query/mod.rs | 3 | ||||
| -rw-r--r-- | src/librustc_middle/ty/context.rs | 4 | ||||
| -rw-r--r-- | src/librustc_typeck/collect.rs | 2 |
5 files changed, 8 insertions, 6 deletions
diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index dbfa675e011..6a4b35ed3d7 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -798,7 +798,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { ) } - 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); diff --git a/src/librustc_middle/arena.rs b/src/librustc_middle/arena.rs index 6692600a093..bbeacbfc538 100644 --- a/src/librustc_middle/arena.rs +++ b/src/librustc_middle/arena.rs @@ -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: diff --git a/src/librustc_middle/query/mod.rs b/src/librustc_middle/query/mod.rs index 44db95c4064..62a759f29bc 100644 --- a/src/librustc_middle/query/mod.rs +++ b/src/librustc_middle/query/mod.rs @@ -282,8 +282,7 @@ rustc_queries! { 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> {} diff --git a/src/librustc_middle/ty/context.rs b/src/librustc_middle/ty/context.rs index 118c692ca77..ae06008d0f9 100644 --- a/src/librustc_middle/ty/context.rs +++ b/src/librustc_middle/ty/context.rs @@ -1008,8 +1008,8 @@ impl<'tcx> TyCtxt<'tcx> { 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 { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index b95b5fde4f0..e6aa53dd4f3 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -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(); |
