)
}
- 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);
($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:
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> {}
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 {
)
}
-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();