@@ -210,7 +210,7 @@ use syntax::{attr, errors};
210210use syntax:: parse:: token;
211211
212212use base:: { custom_coerce_unsize_info, llvm_linkage_by_name} ;
213- use context:: CrateContext ;
213+ use context:: SharedCrateContext ;
214214use common:: { fulfill_obligation, normalize_and_test_predicates, type_is_sized} ;
215215use glue:: { self , DropGlueKind } ;
216216use llvm;
@@ -319,7 +319,7 @@ impl<'tcx> ReferenceMap<'tcx> {
319319 }
320320}
321321
322- pub fn collect_crate_translation_items < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
322+ pub fn collect_crate_translation_items < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
323323 mode : TransItemCollectionMode )
324324 -> ( FnvHashSet < TransItem < ' tcx > > ,
325325 ReferenceMap < ' tcx > ) {
@@ -347,7 +347,7 @@ pub fn collect_crate_translation_items<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
347347
348348// Find all non-generic items by walking the HIR. These items serve as roots to
349349// start monomorphizing from.
350- fn collect_roots < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
350+ fn collect_roots < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
351351 mode : TransItemCollectionMode )
352352 -> Vec < TransItem < ' tcx > > {
353353 debug ! ( "Collecting roots" ) ;
@@ -368,7 +368,7 @@ fn collect_roots<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
368368}
369369
370370// Collect all monomorphized translation items reachable from `starting_point`
371- fn collect_items_rec < ' a , ' tcx : ' a > ( ccx : & CrateContext < ' a , ' tcx > ,
371+ fn collect_items_rec < ' a , ' tcx : ' a > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
372372 starting_point : TransItem < ' tcx > ,
373373 visited : & mut FnvHashSet < TransItem < ' tcx > > ,
374374 recursion_depths : & mut DefIdMap < usize > ,
@@ -473,7 +473,7 @@ fn check_recursion_limit<'tcx>(tcx: &TyCtxt<'tcx>,
473473}
474474
475475struct MirNeighborCollector < ' a , ' tcx : ' a > {
476- ccx : & ' a CrateContext < ' a , ' tcx > ,
476+ ccx : & ' a SharedCrateContext < ' a , ' tcx > ,
477477 mir : & ' a mir:: Mir < ' tcx > ,
478478 output : & ' a mut Vec < TransItem < ' tcx > > ,
479479 param_substs : & ' tcx Substs < ' tcx >
@@ -593,7 +593,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
593593 // object shim or a closure that is handled differently),
594594 // we check if the callee is something that will actually
595595 // result in a translation item ...
596- if can_result_in_trans_item ( self . ccx , callee_def_id) {
596+ if can_result_in_trans_item ( self . ccx . tcx ( ) , callee_def_id) {
597597 // ... and create one if it does.
598598 let trans_item = create_fn_trans_item ( self . ccx . tcx ( ) ,
599599 callee_def_id,
@@ -606,21 +606,21 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
606606
607607 self . super_operand ( operand) ;
608608
609- fn can_result_in_trans_item < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
610- def_id : DefId )
611- -> bool {
612- if !match ccx . tcx ( ) . lookup_item_type ( def_id) . ty . sty {
609+ fn can_result_in_trans_item < ' tcx > ( tcx : & TyCtxt < ' tcx > ,
610+ def_id : DefId )
611+ -> bool {
612+ if !match tcx. lookup_item_type ( def_id) . ty . sty {
613613 ty:: TyFnDef ( def_id, _, _) => {
614614 // Some constructors also have type TyFnDef but they are
615615 // always instantiated inline and don't result in
616616 // translation item. Same for FFI functions.
617- match ccx . tcx ( ) . map . get_if_local ( def_id) {
617+ match tcx. map . get_if_local ( def_id) {
618618 Some ( hir_map:: NodeVariant ( _) ) |
619619 Some ( hir_map:: NodeStructCtor ( _) ) |
620620 Some ( hir_map:: NodeForeignItem ( _) ) => false ,
621621 Some ( _) => true ,
622622 None => {
623- ccx . sess ( ) . cstore . variant_kind ( def_id) . is_none ( )
623+ tcx . sess . cstore . variant_kind ( def_id) . is_none ( )
624624 }
625625 }
626626 }
@@ -630,7 +630,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
630630 return false ;
631631 }
632632
633- can_have_local_instance ( ccx . tcx ( ) , def_id)
633+ can_have_local_instance ( tcx, def_id)
634634 }
635635 }
636636}
@@ -644,7 +644,7 @@ fn can_have_local_instance<'tcx>(tcx: &TyCtxt<'tcx>,
644644 def_id. is_local ( ) || tcx. sess . cstore . is_item_mir_available ( def_id)
645645}
646646
647- fn find_drop_glue_neighbors < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
647+ fn find_drop_glue_neighbors < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
648648 dg : DropGlueKind < ' tcx > ,
649649 output : & mut Vec < TransItem < ' tcx > > ) {
650650 let ty = match dg {
@@ -700,7 +700,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
700700 substs : self_type_substs,
701701 } . to_poly_trait_ref ( ) ;
702702
703- let substs = match fulfill_obligation ( ccx. shared ( ) , DUMMY_SP , trait_ref) {
703+ let substs = match fulfill_obligation ( ccx, DUMMY_SP , trait_ref) {
704704 traits:: VtableImpl ( data) => data. substs ,
705705 _ => bug ! ( )
706706 } ;
@@ -779,7 +779,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
779779 }
780780}
781781
782- fn do_static_dispatch < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
782+ fn do_static_dispatch < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
783783 fn_def_id : DefId ,
784784 fn_substs : & ' tcx Substs < ' tcx > ,
785785 param_substs : & ' tcx Substs < ' tcx > )
@@ -822,7 +822,7 @@ fn do_static_dispatch<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
822822
823823// Given a trait-method and substitution information, find out the actual
824824// implementation of the trait method.
825- fn do_static_trait_method_dispatch < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
825+ fn do_static_trait_method_dispatch < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
826826 trait_method : & ty:: Method ,
827827 trait_id : DefId ,
828828 callee_substs : & ' tcx Substs < ' tcx > ,
@@ -843,7 +843,7 @@ fn do_static_trait_method_dispatch<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
843843 callee_substs) ;
844844
845845 let trait_ref = ty:: Binder ( rcvr_substs. to_trait_ref ( tcx, trait_id) ) ;
846- let vtbl = fulfill_obligation ( ccx. shared ( ) , DUMMY_SP , trait_ref) ;
846+ let vtbl = fulfill_obligation ( ccx, DUMMY_SP , trait_ref) ;
847847
848848 // Now that we know which impl is being used, we can dispatch to
849849 // the actual function:
@@ -911,7 +911,7 @@ fn do_static_trait_method_dispatch<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
911911///
912912/// Finally, there is also the case of custom unsizing coercions, e.g. for
913913/// smart pointers such as `Rc` and `Arc`.
914- fn find_vtable_types_for_unsizing < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
914+ fn find_vtable_types_for_unsizing < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
915915 source_ty : ty:: Ty < ' tcx > ,
916916 target_ty : ty:: Ty < ' tcx > )
917917 -> ( ty:: Ty < ' tcx > , ty:: Ty < ' tcx > ) {
@@ -936,7 +936,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
936936 & ty:: TyStruct ( target_adt_def, target_substs) ) => {
937937 assert_eq ! ( source_adt_def, target_adt_def) ;
938938
939- let kind = custom_coerce_unsize_info ( ccx. shared ( ) , source_ty, target_ty) ;
939+ let kind = custom_coerce_unsize_info ( ccx, source_ty, target_ty) ;
940940
941941 let coerce_index = match kind {
942942 CustomCoerceUnsized :: Struct ( i) => i
@@ -986,7 +986,7 @@ fn create_fn_trans_item<'tcx>(tcx: &TyCtxt<'tcx>,
986986
987987/// Creates a `TransItem` for each method that is referenced by the vtable for
988988/// the given trait/impl pair.
989- fn create_trans_items_for_vtable_methods < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
989+ fn create_trans_items_for_vtable_methods < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ,
990990 trait_ty : ty:: Ty < ' tcx > ,
991991 impl_ty : ty:: Ty < ' tcx > ,
992992 output : & mut Vec < TransItem < ' tcx > > ) {
@@ -998,7 +998,7 @@ fn create_trans_items_for_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
998998
999999 // Walk all methods of the trait, including those of its supertraits
10001000 for trait_ref in traits:: supertraits ( ccx. tcx ( ) , poly_trait_ref) {
1001- let vtable = fulfill_obligation ( ccx. shared ( ) , DUMMY_SP , trait_ref) ;
1001+ let vtable = fulfill_obligation ( ccx, DUMMY_SP , trait_ref) ;
10021002 match vtable {
10031003 traits:: VtableImpl (
10041004 traits:: VtableImplData {
@@ -1035,7 +1035,7 @@ fn create_trans_items_for_vtable_methods<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
10351035//=-----------------------------------------------------------------------------
10361036
10371037struct RootCollector < ' b , ' a : ' b , ' tcx : ' a + ' b > {
1038- ccx : & ' b CrateContext < ' a , ' tcx > ,
1038+ ccx : & ' b SharedCrateContext < ' a , ' tcx > ,
10391039 mode : TransItemCollectionMode ,
10401040 output : & ' b mut Vec < TransItem < ' tcx > > ,
10411041 enclosing_item : Option < & ' tcx hir:: Item > ,
@@ -1546,12 +1546,12 @@ pub enum TransItemState {
15461546 NotPredictedButGenerated ,
15471547}
15481548
1549- pub fn collecting_debug_information ( ccx : & CrateContext ) -> bool {
1549+ pub fn collecting_debug_information ( ccx : & SharedCrateContext ) -> bool {
15501550 return cfg ! ( debug_assertions) &&
15511551 ccx. sess ( ) . opts . debugging_opts . print_trans_items . is_some ( ) ;
15521552}
15531553
1554- pub fn print_collection_results < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ) {
1554+ pub fn print_collection_results < ' a , ' tcx > ( ccx : & SharedCrateContext < ' a , ' tcx > ) {
15551555 use std:: hash:: { Hash , SipHasher , Hasher } ;
15561556
15571557 if !collecting_debug_information ( ccx) {
0 commit comments