pub fn create_and_enter<F, R>(s: Session,
                                 arenas: &'tcx CtxtArenas<'tcx>,
                                 def_map: DefMap,
                                 named_region_map: resolve_lifetime::NamedRegionMap,
                                 map: ast_map::Map<'tcx>,
                                 freevars: RefCell<FreevarMap>,
                                 region_maps: RegionMaps,
                                 lang_items: middle::lang_items::LanguageItems,
                                 stability: stability::Index<'tcx>,
                                 f: F) -> (Session, R)
                                 where F: FnOnce(&ctxt<'tcx>) -> R
    {
        let interner = RefCell::new(FnvHashMap());
        let common_types = CommonTypes::new(&arenas.type_, &interner);

        tls::enter(ctxt {
            arenas: arenas,
            interner: interner,
            substs_interner: RefCell::new(FnvHashMap()),
            bare_fn_interner: RefCell::new(FnvHashMap()),
            region_interner: RefCell::new(FnvHashMap()),
            stability_interner: RefCell::new(FnvHashMap()),
            types: common_types,
            named_region_map: named_region_map,
            region_maps: region_maps,
            free_region_maps: RefCell::new(FnvHashMap()),
            item_variance_map: RefCell::new(DefIdMap()),
            variance_computed: Cell::new(false),
            sess: s,
            def_map: def_map,
            tables: RefCell::new(Tables::empty()),
            impl_trait_refs: RefCell::new(DefIdMap()),
            trait_defs: RefCell::new(DefIdMap()),
            adt_defs: RefCell::new(DefIdMap()),
            predicates: RefCell::new(DefIdMap()),
            super_predicates: RefCell::new(DefIdMap()),
            fulfilled_predicates: RefCell::new(traits::FulfilledPredicates::new()),
            map: map,
            freevars: freevars,
            tcache: RefCell::new(DefIdMap()),
            rcache: RefCell::new(FnvHashMap()),
            tc_cache: RefCell::new(FnvHashMap()),
            ast_ty_to_ty_cache: RefCell::new(NodeMap()),
            impl_or_trait_items: RefCell::new(DefIdMap()),
            trait_item_def_ids: RefCell::new(DefIdMap()),
            trait_items_cache: RefCell::new(DefIdMap()),
            ty_param_defs: RefCell::new(NodeMap()),
            normalized_cache: RefCell::new(FnvHashMap()),
            lang_items: lang_items,
            provided_method_sources: RefCell::new(DefIdMap()),
            destructors: RefCell::new(DefIdSet()),
            inherent_impls: RefCell::new(DefIdMap()),
            impl_items: RefCell::new(DefIdMap()),
            used_unsafe: RefCell::new(NodeSet()),
            used_mut_nodes: RefCell::new(NodeSet()),
            populated_external_types: RefCell::new(DefIdSet()),
            populated_external_primitive_impls: RefCell::new(DefIdSet()),
            extern_const_statics: RefCell::new(DefIdMap()),
            extern_const_variants: RefCell::new(DefIdMap()),
            extern_const_fns: RefCell::new(DefIdMap()),
            node_lint_levels: RefCell::new(FnvHashMap()),
            transmute_restrictions: RefCell::new(Vec::new()),
            stability: RefCell::new(stability),
            selection_cache: traits::SelectionCache::new(),
            repr_hint_cache: RefCell::new(DefIdMap()),
            const_qualif_map: RefCell::new(NodeMap()),
            custom_coerce_unsized_kinds: RefCell::new(DefIdMap()),
            cast_kinds: RefCell::new(NodeMap()),
            fragment_infos: RefCell::new(DefIdMap()),
       }, f)
    }
/// Create a type context and call the closure with a `&ty::ctxt` 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 `&ty::ctxt` 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 ` &ty :: ctxt ` 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: Session,
                                 arenas: &'tcx CtxtArenas<'tcx>,
                                 def_map: DefMap,
                                 named_region_map: resolve_lifetime::NamedRegionMap,
                                 map: ast_map::Map<'tcx>,
                                 freevars: RefCell<FreevarMap>,
                                 region_maps: RegionMaps,
                                 lang_items: middle::lang_items::LanguageItems,
                                 stability: stability::Index<'tcx>,
                                 f: F) -> (Session, R)
                                 where F: FnOnce(&ctxt<'tcx>) -> R
    {
        let interner = RefCell::new(FnvHashMap());
        let common_types = CommonTypes::new(&arenas.type_, &interner);
        tls::enter(ctxt {
            arenas: arenas,
            interner: interner,
            substs_interner: RefCell::new(FnvHashMap()),
            bare_fn_interner: RefCell::new(FnvHashMap()),
            region_interner: RefCell::new(FnvHashMap()),
            stability_interner: RefCell::new(FnvHashMap()),
            types: common_types,
            named_region_map: named_region_map,
            region_maps: region_maps,
            free_region_maps: RefCell::new(FnvHashMap()),
            item_variance_map: RefCell::new(DefIdMap()),
            variance_computed: Cell::new(false),
            sess: s,
            def_map: def_map,
            tables: RefCell::new(Tables::empty()),
            impl_trait_refs: RefCell::new(DefIdMap()),
            trait_defs: RefCell::new(DefIdMap()),
            adt_defs: RefCell::new(DefIdMap()),
            predicates: RefCell::new(DefIdMap()),
            super_predicates: RefCell::new(DefIdMap()),
            fulfilled_predicates: RefCell::new(traits::FulfilledPredicates::new()),
            map: map,
            freevars: freevars,
            tcache: RefCell::new(DefIdMap()),
            rcache: RefCell::new(FnvHashMap()),
            tc_cache: RefCell::new(FnvHashMap()),
            ast_ty_to_ty_cache: RefCell::new(NodeMap()),
            impl_or_trait_items: RefCell::new(DefIdMap()),
            trait_item_def_ids: RefCell::new(DefIdMap()),
            trait_items_cache: RefCell::new(DefIdMap()),
            ty_param_defs: RefCell::new(NodeMap()),
            normalized_cache: RefCell::new(FnvHashMap()),
            lang_items: lang_items,
            provided_method_sources: RefCell::new(DefIdMap()),
            destructors: RefCell::new(DefIdSet()),
            inherent_impls: RefCell::new(DefIdMap()),
            impl_items: RefCell::new(DefIdMap()),
            used_unsafe: RefCell::new(NodeSet()),
            used_mut_nodes: RefCell::new(NodeSet()),
            populated_external_types: RefCell::new(DefIdSet()),
            populated_external_primitive_impls: RefCell::new(DefIdSet()),
            extern_const_statics: RefCell::new(DefIdMap()),
            extern_const_variants: RefCell::new(DefIdMap()),
            extern_const_fns: RefCell::new(DefIdMap()),
            node_lint_levels: RefCell::new(FnvHashMap()),
            transmute_restrictions: RefCell::new(Vec::new()),
            stability: RefCell::new(stability),
            selection_cache: traits::SelectionCache::new(),
            repr_hint_cache: RefCell::new(DefIdMap()),
            const_qualif_map: RefCell::new(NodeMap()),
            custom_coerce_unsized_kinds: RefCell::new(DefIdMap()),
            cast_kinds: RefCell::new(NodeMap()),
            fragment_infos: RefCell::new(DefIdMap()),
       }, f)
    }
pub fn create_and_enter < F , R > ( s : Session , arenas : & ' tcx CtxtArenas < ' tcx > , def_map : DefMap , named_region_map : resolve_lifetime :: NamedRegionMap , map : ast_map :: Map < ' tcx > , freevars : RefCell < FreevarMap > , region_maps : RegionMaps , lang_items : middle :: lang_items :: LanguageItems , stability : stability :: Index < ' tcx > , f : F ) -> ( Session , R ) where F : FnOnce ( & ctxt < ' tcx > ) -> R { let interner = RefCell :: new ( FnvHashMap ( ) ) ; let common_types = CommonTypes :: new ( & arenas . type_ , & interner ) ; tls :: enter ( ctxt { arenas : arenas , interner : interner , substs_interner : RefCell :: new ( FnvHashMap ( ) ) , bare_fn_interner : RefCell :: new ( FnvHashMap ( ) ) , region_interner : RefCell :: new ( FnvHashMap ( ) ) , stability_interner : RefCell :: new ( FnvHashMap ( ) ) , types : common_types , named_region_map : named_region_map , region_maps : region_maps , free_region_maps : RefCell :: new ( FnvHashMap ( ) ) , item_variance_map : RefCell :: new ( DefIdMap ( ) ) , variance_computed : Cell :: new ( false ) , sess : s , def_map : def_map , tables : RefCell :: new ( Tables :: empty ( ) ) , impl_trait_refs : RefCell :: new ( DefIdMap ( ) ) , trait_defs : RefCell :: new ( DefIdMap ( ) ) , adt_defs : RefCell :: new ( DefIdMap ( ) ) , predicates : RefCell :: new ( DefIdMap ( ) ) , super_predicates : RefCell :: new ( DefIdMap ( ) ) , fulfilled_predicates : RefCell :: new ( traits :: FulfilledPredicates :: new ( ) ) , map : map , freevars : freevars , tcache : RefCell :: new ( DefIdMap ( ) ) , rcache : RefCell :: new ( FnvHashMap ( ) ) , tc_cache : RefCell :: new ( FnvHashMap ( ) ) , ast_ty_to_ty_cache : RefCell :: new ( NodeMap ( ) ) , impl_or_trait_items : RefCell :: new ( DefIdMap ( ) ) , trait_item_def_ids : RefCell :: new ( DefIdMap ( ) ) , trait_items_cache : RefCell :: new ( DefIdMap ( ) ) , ty_param_defs : RefCell :: new ( NodeMap ( ) ) , normalized_cache : RefCell :: new ( FnvHashMap ( ) ) , lang_items : lang_items , provided_method_sources : RefCell :: new ( DefIdMap ( ) ) , destructors : RefCell :: new ( DefIdSet ( ) ) , inherent_impls : RefCell :: new ( DefIdMap ( ) ) , impl_items : RefCell :: new ( DefIdMap ( ) ) , used_unsafe : RefCell :: new ( NodeSet ( ) ) , used_mut_nodes : RefCell :: new ( NodeSet ( ) ) , populated_external_types : RefCell :: new ( DefIdSet ( ) ) , populated_external_primitive_impls : RefCell :: new ( DefIdSet ( ) ) , extern_const_statics : RefCell :: new ( DefIdMap ( ) ) , extern_const_variants : RefCell :: new ( DefIdMap ( ) ) , extern_const_fns : RefCell :: new ( DefIdMap ( ) ) , node_lint_levels : RefCell :: new ( FnvHashMap ( ) ) , transmute_restrictions : RefCell :: new ( Vec :: new ( ) ) , stability : RefCell :: new ( stability ) , selection_cache : traits :: SelectionCache :: new ( ) , repr_hint_cache : RefCell :: new ( DefIdMap ( ) ) , const_qualif_map : RefCell :: new ( NodeMap ( ) ) , custom_coerce_unsized_kinds : RefCell :: new ( DefIdMap ( ) ) , cast_kinds : RefCell :: new ( NodeMap ( ) ) , fragment_infos : RefCell :: new ( DefIdMap ( ) ) , } , f ) }
Create a type context and call the closure with a `&ty::ctxt` reference
to the context.
Create a type context and call the closure with a ` &ty :: ctxt ` reference to the context .
s
Session
arenas
&'tcx CtxtArenas<'tcx>
def_map
DefMap
named_region_map
resolve_lifetime::NamedRegionMap
map
ast_map::Map<'tcx>
freevars
RefCell<FreevarMap>
region_maps
RegionMaps
lang_items
middle::lang_items::LanguageItems
stability
stability::Index<'tcx>
f
F
s
Session
arenas
&'tcx CtxtArenas<'tcx>
def_map
DefMap
named_region_map
resolve_lifetime::NamedRegionMap
map
ast_map::Map<'tcx>
freevars
RefCell<FreevarMap>
region_maps
RegionMaps
lang_items
middle::lang_items::LanguageItems
stability
stability::Index<'tcx>
f
F