pub fn create_and_enter<F, R>(s: &'tcx Session,
                                  arenas: &'tcx GlobalArenas<'tcx>,
                                  arena: &'tcx DroplessArena,
                                  resolutions: ty::Resolutions,
                                  named_region_map: resolve_lifetime::NamedRegionMap,
                                  hir: hir_map::Map<'tcx>,
                                  region_maps: RegionMaps,
                                  lang_items: middle::lang_items::LanguageItems,
                                  stability: stability::Index<'tcx>,
                                  crate_name: &str,
                                  f: F) -> R
                                  where F: for<'b> FnOnce(TyCtxt<'b, 'tcx, 'tcx>) -> R
    {
        let data_layout = TargetDataLayout::parse(s);
        let interners = CtxtInterners::new(arena);
        let common_types = CommonTypes::new(&interners);
        let dep_graph = hir.dep_graph.clone();
        let fulfilled_predicates = traits::GlobalFulfilledPredicates::new(dep_graph.clone());
        tls::enter_global(GlobalCtxt {
            specializes_cache: RefCell::new(traits::SpecializesCache::new()),
            global_arenas: arenas,
            global_interners: interners,
            dep_graph: dep_graph.clone(),
            types: common_types,
            named_region_map: named_region_map,
            region_maps: region_maps,
            free_region_maps: RefCell::new(FxHashMap()),
            item_variance_map: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            variance_computed: Cell::new(false),
            sess: s,
            trait_map: resolutions.trait_map,
            tables: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            impl_trait_refs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            trait_defs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            adt_defs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            adt_sized_constraint: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            generics: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            predicates: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            super_predicates: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            fulfilled_predicates: RefCell::new(fulfilled_predicates),
            hir: hir,
            mir_map: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            freevars: RefCell::new(resolutions.freevars),
            maybe_unused_trait_imports: resolutions.maybe_unused_trait_imports,
            item_types: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            rcache: RefCell::new(FxHashMap()),
            tc_cache: RefCell::new(FxHashMap()),
            associated_items: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            associated_item_def_ids: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            ty_param_defs: RefCell::new(NodeMap()),
            normalized_cache: RefCell::new(FxHashMap()),
            inhabitedness_cache: RefCell::new(FxHashMap()),
            lang_items: lang_items,
            inherent_impls: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            used_unsafe: RefCell::new(NodeSet()),
            used_mut_nodes: RefCell::new(NodeSet()),
            used_trait_imports: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            populated_external_types: RefCell::new(DefIdSet()),
            populated_external_primitive_impls: RefCell::new(DefIdSet()),
            stability: RefCell::new(stability),
            selection_cache: traits::SelectionCache::new(),
            evaluation_cache: traits::EvaluationCache::new(),
            repr_hint_cache: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            rvalue_promotable_to_static: RefCell::new(NodeMap()),
            custom_coerce_unsized_kinds: RefCell::new(DefIdMap()),
            closure_tys: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            closure_kinds: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            fragment_infos: RefCell::new(DefIdMap()),
            crate_name: Symbol::intern(crate_name),
            data_layout: data_layout,
            layout_cache: RefCell::new(FxHashMap()),
            layout_interner: RefCell::new(FxHashSet()),
            layout_depth: Cell::new(0),
            derive_macros: RefCell::new(NodeMap()),
            stability_interner: RefCell::new(FxHashSet()),
       }, f)
    }
/// Create a type context and call the closure with a `TyCtxt` reference
/// to the context. The closure enforces that the type context and any interned
/// value (types, substs, etc.) can only be used while `ty::tls` has a valid
/// reference to the context, to allow formatting values that need it.
Create a type context and call the closure with a `TyCtxt` reference
to the context. The closure enforces that the type context and any interned
value (types, substs, etc.) can only be used while `ty::tls` has a valid
reference to the context, to allow formatting values that need it.
Create a type context and call the closure with a ` TyCtxt ` reference to the context . The closure enforces that the type context and any interned value ( types substs etc . ) can only be used while ` ty :: tls ` has a valid reference to the context to allow formatting values that need it .
pub fn create_and_enter<F, R>(s: &'tcx Session,
                                  arenas: &'tcx GlobalArenas<'tcx>,
                                  arena: &'tcx DroplessArena,
                                  resolutions: ty::Resolutions,
                                  named_region_map: resolve_lifetime::NamedRegionMap,
                                  hir: hir_map::Map<'tcx>,
                                  region_maps: RegionMaps,
                                  lang_items: middle::lang_items::LanguageItems,
                                  stability: stability::Index<'tcx>,
                                  crate_name: &str,
                                  f: F) -> R
                                  where F: for<'b> FnOnce(TyCtxt<'b, 'tcx, 'tcx>) -> R
    {
        let data_layout = TargetDataLayout::parse(s);
        let interners = CtxtInterners::new(arena);
        let common_types = CommonTypes::new(&interners);
        let dep_graph = hir.dep_graph.clone();
        let fulfilled_predicates = traits::GlobalFulfilledPredicates::new(dep_graph.clone());
        tls::enter_global(GlobalCtxt {
            specializes_cache: RefCell::new(traits::SpecializesCache::new()),
            global_arenas: arenas,
            global_interners: interners,
            dep_graph: dep_graph.clone(),
            types: common_types,
            named_region_map: named_region_map,
            region_maps: region_maps,
            free_region_maps: RefCell::new(FxHashMap()),
            item_variance_map: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            variance_computed: Cell::new(false),
            sess: s,
            trait_map: resolutions.trait_map,
            tables: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            impl_trait_refs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            trait_defs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            adt_defs: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            adt_sized_constraint: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            generics: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            predicates: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            super_predicates: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            fulfilled_predicates: RefCell::new(fulfilled_predicates),
            hir: hir,
            mir_map: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            freevars: RefCell::new(resolutions.freevars),
            maybe_unused_trait_imports: resolutions.maybe_unused_trait_imports,
            item_types: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            rcache: RefCell::new(FxHashMap()),
            tc_cache: RefCell::new(FxHashMap()),
            associated_items: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            associated_item_def_ids: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            ty_param_defs: RefCell::new(NodeMap()),
            normalized_cache: RefCell::new(FxHashMap()),
            inhabitedness_cache: RefCell::new(FxHashMap()),
            lang_items: lang_items,
            inherent_impls: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            used_unsafe: RefCell::new(NodeSet()),
            used_mut_nodes: RefCell::new(NodeSet()),
            used_trait_imports: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            populated_external_types: RefCell::new(DefIdSet()),
            populated_external_primitive_impls: RefCell::new(DefIdSet()),
            stability: RefCell::new(stability),
            selection_cache: traits::SelectionCache::new(),
            evaluation_cache: traits::EvaluationCache::new(),
            repr_hint_cache: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            rvalue_promotable_to_static: RefCell::new(NodeMap()),
            custom_coerce_unsized_kinds: RefCell::new(DefIdMap()),
            closure_tys: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            closure_kinds: RefCell::new(DepTrackingMap::new(dep_graph.clone())),
            fragment_infos: RefCell::new(DefIdMap()),
            crate_name: Symbol::intern(crate_name),
            data_layout: data_layout,
            layout_cache: RefCell::new(FxHashMap()),
            layout_interner: RefCell::new(FxHashSet()),
            layout_depth: Cell::new(0),
            derive_macros: RefCell::new(NodeMap()),
            stability_interner: RefCell::new(FxHashSet()),
       }, f)
    }
pub fn create_and_enter < F , R > ( s : & ' tcx Session , arenas : & ' tcx GlobalArenas < ' tcx > , arena : & ' tcx DroplessArena , resolutions : ty :: Resolutions , named_region_map : resolve_lifetime :: NamedRegionMap , hir : hir_map :: Map < ' tcx > , region_maps : RegionMaps , lang_items : middle :: lang_items :: LanguageItems , stability : stability :: Index < ' tcx > , crate_name : & str , f : F ) -> R where F : for < ' b > FnOnce ( TyCtxt < ' b , ' tcx , ' tcx > ) -> R { let data_layout = TargetDataLayout :: parse ( s ) ; let interners = CtxtInterners :: new ( arena ) ; let common_types = CommonTypes :: new ( & interners ) ; let dep_graph = hir . dep_graph . clone ( ) ; let fulfilled_predicates = traits :: GlobalFulfilledPredicates :: new ( dep_graph . clone ( ) ) ; tls :: enter_global ( GlobalCtxt { specializes_cache : RefCell :: new ( traits :: SpecializesCache :: new ( ) ) , global_arenas : arenas , global_interners : interners , dep_graph : dep_graph . clone ( ) , types : common_types , named_region_map : named_region_map , region_maps : region_maps , free_region_maps : RefCell :: new ( FxHashMap ( ) ) , item_variance_map : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , variance_computed : Cell :: new ( false ) , sess : s , trait_map : resolutions . trait_map , tables : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , impl_trait_refs : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , trait_defs : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , adt_defs : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , adt_sized_constraint : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , generics : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , predicates : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , super_predicates : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , fulfilled_predicates : RefCell :: new ( fulfilled_predicates ) , hir : hir , mir_map : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , freevars : RefCell :: new ( resolutions . freevars ) , maybe_unused_trait_imports : resolutions . maybe_unused_trait_imports , item_types : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , rcache : RefCell :: new ( FxHashMap ( ) ) , tc_cache : RefCell :: new ( FxHashMap ( ) ) , associated_items : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , associated_item_def_ids : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , ty_param_defs : RefCell :: new ( NodeMap ( ) ) , normalized_cache : RefCell :: new ( FxHashMap ( ) ) , inhabitedness_cache : RefCell :: new ( FxHashMap ( ) ) , lang_items : lang_items , inherent_impls : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , used_unsafe : RefCell :: new ( NodeSet ( ) ) , used_mut_nodes : RefCell :: new ( NodeSet ( ) ) , used_trait_imports : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , populated_external_types : RefCell :: new ( DefIdSet ( ) ) , populated_external_primitive_impls : RefCell :: new ( DefIdSet ( ) ) , stability : RefCell :: new ( stability ) , selection_cache : traits :: SelectionCache :: new ( ) , evaluation_cache : traits :: EvaluationCache :: new ( ) , repr_hint_cache : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , rvalue_promotable_to_static : RefCell :: new ( NodeMap ( ) ) , custom_coerce_unsized_kinds : RefCell :: new ( DefIdMap ( ) ) , closure_tys : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , closure_kinds : RefCell :: new ( DepTrackingMap :: new ( dep_graph . clone ( ) ) ) , fragment_infos : RefCell :: new ( DefIdMap ( ) ) , crate_name : Symbol :: intern ( crate_name ) , data_layout : data_layout , layout_cache : RefCell :: new ( FxHashMap ( ) ) , layout_interner : RefCell :: new ( FxHashSet ( ) ) , layout_depth : Cell :: new ( 0 ) , derive_macros : RefCell :: new ( NodeMap ( ) ) , stability_interner : RefCell :: new ( FxHashSet ( ) ) , } , f ) }
Create a type context and call the closure with a `TyCtxt` reference
to the context.
Create a type context and call the closure with a ` TyCtxt ` reference to the context .
s
&'tcx Session
arenas
&'tcx GlobalArenas<'tcx>
arena
&'tcx DroplessArena
resolutions
ty::Resolutions
named_region_map
resolve_lifetime::NamedRegionMap
hir
hir_map::Map<'tcx>
region_maps
RegionMaps
lang_items
middle::lang_items::LanguageItems
stability
stability::Index<'tcx>
crate_name
&str
f
F