Skip to content

Commit bd61870

Browse files
committed
Fix incremental compilation.
1 parent 0a010b3 commit bd61870

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

src/librustc_metadata/rmeta/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
798798
)
799799
}
800800

801-
fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx>) -> ty::AdtDef {
801+
fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx>) -> &'tcx ty::AdtDef {
802802
let kind = self.kind(item_id);
803803
let did = self.local_def_id(item_id);
804804

src/librustc_middle/arena.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ macro_rules! arena_types {
1212
($macro:path, $args:tt, $tcx:lifetime) => (
1313
$macro!($args, [
1414
[] layouts: rustc_target::abi::Layout,
15+
// AdtDef are interned and compared by address
16+
[] adt_def: rustc_middle::ty::AdtDef,
1517
[decode] tables: rustc_middle::ty::TypeckTables<$tcx>,
1618
[] const_allocs: rustc_middle::mir::interpret::Allocation,
19+
// Required for the incremental on-disk cache
1720
[few, decode] mir_keys: rustc_hir::def_id::DefIdSet,
1821
[] region_scope_tree: rustc_middle::middle::region::ScopeTree,
1922
[] dropck_outlives:

src/librustc_middle/query/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@ rustc_queries! {
282282
query trait_def(_: DefId) -> ty::TraitDef {
283283
storage(ArenaCacheSelector<'tcx>)
284284
}
285-
query adt_def(_: DefId) -> ty::AdtDef {
286-
storage(ArenaCacheSelector<'tcx>)
285+
query adt_def(_: DefId) -> &'tcx ty::AdtDef {
287286
}
288287
query adt_destructor(_: DefId) -> Option<ty::Destructor> {}
289288

src/librustc_middle/ty/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,8 @@ impl<'tcx> TyCtxt<'tcx> {
10081008
kind: AdtKind,
10091009
variants: IndexVec<VariantIdx, ty::VariantDef>,
10101010
repr: ReprOptions,
1011-
) -> ty::AdtDef {
1012-
ty::AdtDef::new(self, did, kind, variants, repr)
1011+
) -> &'tcx ty::AdtDef {
1012+
self.arena.alloc(ty::AdtDef::new(self, did, kind, variants, repr))
10131013
}
10141014

10151015
pub fn intern_const_alloc(self, alloc: Allocation) -> &'tcx Allocation {

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ fn convert_variant(
861861
)
862862
}
863863

864-
fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> ty::AdtDef {
864+
fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::AdtDef {
865865
use rustc_hir::*;
866866

867867
let def_id = def_id.expect_local();

0 commit comments

Comments
 (0)