@@ -459,7 +459,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
459459 format ! ( "Could not find MIR for closure: {:?}" , def_id)
460460 } ) ;
461461
462- let concrete_substs = monomorphize:: apply_param_substs ( self . scx . tcx ( ) ,
462+ let concrete_substs = monomorphize:: apply_param_substs ( self . scx ,
463463 self . param_substs ,
464464 & substs. func_substs ) ;
465465 let concrete_substs = self . scx . tcx ( ) . erase_regions ( & concrete_substs) ;
@@ -477,11 +477,11 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
477477 // have to instantiate all methods of the trait being cast to, so we
478478 // can build the appropriate vtable.
479479 mir:: Rvalue :: Cast ( mir:: CastKind :: Unsize , ref operand, target_ty) => {
480- let target_ty = monomorphize:: apply_param_substs ( self . scx . tcx ( ) ,
480+ let target_ty = monomorphize:: apply_param_substs ( self . scx ,
481481 self . param_substs ,
482482 & target_ty) ;
483483 let source_ty = operand. ty ( self . mir , self . scx . tcx ( ) ) ;
484- let source_ty = monomorphize:: apply_param_substs ( self . scx . tcx ( ) ,
484+ let source_ty = monomorphize:: apply_param_substs ( self . scx ,
485485 self . param_substs ,
486486 & source_ty) ;
487487 let ( source_ty, target_ty) = find_vtable_types_for_unsizing ( self . scx ,
@@ -508,7 +508,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
508508 assert ! ( can_have_local_instance( self . scx. tcx( ) , exchange_malloc_fn_def_id) ) ;
509509 let empty_substs = self . scx . empty_substs_for_def_id ( exchange_malloc_fn_def_id) ;
510510 let exchange_malloc_fn_trans_item =
511- create_fn_trans_item ( self . scx . tcx ( ) ,
511+ create_fn_trans_item ( self . scx ,
512512 exchange_malloc_fn_def_id,
513513 empty_substs,
514514 self . param_substs ) ;
@@ -531,7 +531,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
531531 let ty = lvalue. ty ( self . mir , self . scx . tcx ( ) )
532532 . to_ty ( self . scx . tcx ( ) ) ;
533533
534- let ty = monomorphize:: apply_param_substs ( self . scx . tcx ( ) ,
534+ let ty = monomorphize:: apply_param_substs ( self . scx ,
535535 self . param_substs ,
536536 & ty) ;
537537 assert ! ( ty. is_normalized_for_trans( ) ) ;
@@ -555,7 +555,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
555555 // references to `const` items
556556 if let mir:: Literal :: Item { def_id, substs } = constant. literal {
557557 let tcx = self . scx . tcx ( ) ;
558- let substs = monomorphize:: apply_param_substs ( tcx ,
558+ let substs = monomorphize:: apply_param_substs ( self . scx ,
559559 self . param_substs ,
560560 & substs) ;
561561
@@ -613,7 +613,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
613613 // result in a translation item ...
614614 if can_result_in_trans_item ( self . scx . tcx ( ) , callee_def_id) {
615615 // ... and create one if it does.
616- let trans_item = create_fn_trans_item ( self . scx . tcx ( ) ,
616+ let trans_item = create_fn_trans_item ( self . scx ,
617617 callee_def_id,
618618 callee_substs,
619619 self . param_substs ) ;
@@ -670,7 +670,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
670670 if is_drop_in_place_intrinsic ( tcx, def_id, bare_fn_ty) => {
671671 let operand_ty = args[ 0 ] . ty ( self . mir , tcx) ;
672672 if let ty:: TyRawPtr ( mt) = operand_ty. sty {
673- let operand_ty = monomorphize:: apply_param_substs ( tcx ,
673+ let operand_ty = monomorphize:: apply_param_substs ( self . scx ,
674674 self . param_substs ,
675675 & mt. ty ) ;
676676 let ty = glue:: get_drop_glue_type ( tcx, operand_ty) ;
@@ -732,7 +732,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
732732 assert ! ( can_have_local_instance( scx. tcx( ) , exchange_free_fn_def_id) ) ;
733733 let fn_substs = scx. empty_substs_for_def_id ( exchange_free_fn_def_id) ;
734734 let exchange_free_fn_trans_item =
735- create_fn_trans_item ( scx. tcx ( ) ,
735+ create_fn_trans_item ( scx,
736736 exchange_free_fn_def_id,
737737 fn_substs,
738738 Substs :: empty ( scx. tcx ( ) ) ) ;
@@ -769,7 +769,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
769769 } ;
770770
771771 if can_have_local_instance ( scx. tcx ( ) , destructor_did) {
772- let trans_item = create_fn_trans_item ( scx. tcx ( ) ,
772+ let trans_item = create_fn_trans_item ( scx,
773773 destructor_did,
774774 substs,
775775 Substs :: empty ( scx. tcx ( ) ) ) ;
@@ -800,7 +800,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
800800 ty:: TyStruct ( ref adt_def, substs) |
801801 ty:: TyEnum ( ref adt_def, substs) => {
802802 for field in adt_def. all_fields ( ) {
803- let field_type = monomorphize:: apply_param_substs ( scx. tcx ( ) ,
803+ let field_type = monomorphize:: apply_param_substs ( scx,
804804 substs,
805805 & field. unsubst_ty ( ) ) ;
806806 let field_type = glue:: get_drop_glue_type ( scx. tcx ( ) , field_type) ;
@@ -894,8 +894,7 @@ fn do_static_trait_method_dispatch<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
894894 callee_substs,
895895 param_substs) ;
896896
897-
898- let rcvr_substs = monomorphize:: apply_param_substs ( tcx,
897+ let rcvr_substs = monomorphize:: apply_param_substs ( scx,
899898 param_substs,
900899 & callee_substs) ;
901900 let trait_ref = ty:: TraitRef :: from_method ( tcx, trait_id, rcvr_substs) ;
@@ -1016,11 +1015,13 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
10161015 }
10171016}
10181017
1019- fn create_fn_trans_item < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1018+ fn create_fn_trans_item < ' a , ' tcx > ( scx : & SharedCrateContext < ' a , ' tcx > ,
10201019 def_id : DefId ,
10211020 fn_substs : & ' tcx Substs < ' tcx > ,
10221021 param_substs : & ' tcx Substs < ' tcx > )
10231022 -> TransItem < ' tcx > {
1023+ let tcx = scx. tcx ( ) ;
1024+
10241025 debug ! ( "create_fn_trans_item(def_id={}, fn_substs={:?}, param_substs={:?})" ,
10251026 def_id_to_string( tcx, def_id) ,
10261027 fn_substs,
@@ -1029,7 +1030,7 @@ fn create_fn_trans_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
10291030 // We only get here, if fn_def_id either designates a local item or
10301031 // an inlineable external item. Non-inlineable external items are
10311032 // ignored because we don't want to generate any code for them.
1032- let concrete_substs = monomorphize:: apply_param_substs ( tcx ,
1033+ let concrete_substs = monomorphize:: apply_param_substs ( scx ,
10331034 param_substs,
10341035 & fn_substs) ;
10351036 assert ! ( concrete_substs. is_normalized_for_trans( ) ) ;
@@ -1063,7 +1064,7 @@ fn create_trans_items_for_vtable_methods<'a, 'tcx>(scx: &SharedCrateContext<'a,
10631064 // create translation items
10641065 . filter_map ( |impl_method| {
10651066 if can_have_local_instance ( scx. tcx ( ) , impl_method. method . def_id ) {
1066- Some ( create_fn_trans_item ( scx. tcx ( ) ,
1067+ Some ( create_fn_trans_item ( scx,
10671068 impl_method. method . def_id ,
10681069 impl_method. substs ,
10691070 Substs :: empty ( scx. tcx ( ) ) ) )
@@ -1114,7 +1115,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
11141115
11151116 hir:: ItemImpl ( ..) => {
11161117 if self . mode == TransItemCollectionMode :: Eager {
1117- create_trans_items_for_default_impls ( self . scx . tcx ( ) ,
1118+ create_trans_items_for_default_impls ( self . scx ,
11181119 item,
11191120 self . output ) ;
11201121 }
@@ -1202,9 +1203,10 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
12021203 }
12031204}
12041205
1205- fn create_trans_items_for_default_impls < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1206+ fn create_trans_items_for_default_impls < ' a , ' tcx > ( scx : & SharedCrateContext < ' a , ' tcx > ,
12061207 item : & ' tcx hir:: Item ,
12071208 output : & mut Vec < TransItem < ' tcx > > ) {
1209+ let tcx = scx. tcx ( ) ;
12081210 match item. node {
12091211 hir:: ItemImpl ( _,
12101212 _,
@@ -1255,7 +1257,7 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
12551257
12561258 if can_have_local_instance ( tcx, method. def_id ) {
12571259 let empty_substs = tcx. erase_regions ( & mth. substs ) ;
1258- let item = create_fn_trans_item ( tcx ,
1260+ let item = create_fn_trans_item ( scx ,
12591261 method. def_id ,
12601262 callee_substs,
12611263 empty_substs) ;
0 commit comments