@@ -67,7 +67,7 @@ pub struct CtxtArenas<'tcx> {
6767 // references
6868 generics : TypedArena < ty:: Generics < ' tcx > > ,
6969 trait_def : TypedArena < ty:: TraitDef > ,
70- adt_def : TypedArena < ty:: AdtDefData < ' tcx , ' tcx > > ,
70+ adt_def : TypedArena < ty:: AdtDef > ,
7171 mir : TypedArena < RefCell < Mir < ' tcx > > > ,
7272}
7373
@@ -420,6 +420,7 @@ pub struct GlobalCtxt<'tcx> {
420420 pub impl_trait_refs : RefCell < DepTrackingMap < maps:: ImplTraitRefs < ' tcx > > > ,
421421 pub trait_defs : RefCell < DepTrackingMap < maps:: TraitDefs < ' tcx > > > ,
422422 pub adt_defs : RefCell < DepTrackingMap < maps:: AdtDefs < ' tcx > > > ,
423+ pub adt_sized_constraint : RefCell < DepTrackingMap < maps:: AdtSizedConstraint < ' tcx > > > ,
423424
424425 /// Maps from the def-id of an item (trait/struct/enum/fn) to its
425426 /// associated generics and predicates.
@@ -687,22 +688,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
687688 self . global_interners . arenas . trait_def . alloc ( def)
688689 }
689690
690- pub fn insert_adt_def ( self , did : DefId , adt_def : ty:: AdtDefMaster < ' gcx > ) {
691- // this will need a transmute when reverse-variance is removed
692- if let Some ( prev) = self . adt_defs . borrow_mut ( ) . insert ( did, adt_def) {
693- bug ! ( "Tried to overwrite interned AdtDef: {:?}" , prev)
694- }
695- }
696-
697- pub fn intern_adt_def ( self ,
698- did : DefId ,
699- kind : AdtKind ,
700- variants : Vec < ty:: VariantDefData < ' gcx , ' gcx > > )
701- -> ty:: AdtDefMaster < ' gcx > {
702- let def = ty:: AdtDefData :: new ( self , did, kind, variants) ;
703- let interned = self . global_interners . arenas . adt_def . alloc ( def) ;
704- self . insert_adt_def ( did, interned) ;
705- interned
691+ pub fn alloc_adt_def ( self ,
692+ did : DefId ,
693+ kind : AdtKind ,
694+ variants : Vec < ty:: VariantDef > )
695+ -> & ' gcx ty:: AdtDef {
696+ let def = ty:: AdtDef :: new ( self , did, kind, variants) ;
697+ self . global_interners . arenas . adt_def . alloc ( def)
706698 }
707699
708700 pub fn intern_stability ( self , stab : attr:: Stability ) -> & ' gcx attr:: Stability {
@@ -798,6 +790,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
798790 impl_trait_refs : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
799791 trait_defs : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
800792 adt_defs : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
793+ adt_sized_constraint : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
801794 generics : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
802795 predicates : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
803796 super_predicates : RefCell :: new ( DepTrackingMap :: new ( dep_graph. clone ( ) ) ) ,
@@ -1346,7 +1339,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
13461339 self . mk_imm_ref ( self . mk_region ( ty:: ReStatic ) , self . mk_str ( ) )
13471340 }
13481341
1349- pub fn mk_adt ( self , def : AdtDef < ' tcx > , substs : & ' tcx Substs < ' tcx > ) -> Ty < ' tcx > {
1342+ pub fn mk_adt ( self , def : & ' tcx AdtDef , substs : & ' tcx Substs < ' tcx > ) -> Ty < ' tcx > {
13501343 // take a copy of substs so that we own the vectors inside
13511344 self . mk_ty ( TyAdt ( def, substs) )
13521345 }
0 commit comments