@@ -348,7 +348,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(scx: &SharedCrateContext<'a, 'tcx>,
348348 let mir = errors:: expect ( scx. sess ( ) . diagnostic ( ) , scx. get_mir ( def_id) ,
349349 || format ! ( "Could not find MIR for static: {:?}" , def_id) ) ;
350350
351- let empty_substs = scx. tcx ( ) . mk_substs ( Substs :: empty ( ) ) ;
351+ let empty_substs = scx. empty_substs_for_def_id ( def_id ) ;
352352 let mut visitor = MirNeighborCollector {
353353 scx : scx,
354354 mir : & mir,
@@ -496,10 +496,11 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
496496 . unwrap_or_else ( |e| self . scx . sess ( ) . fatal ( & e) ) ;
497497
498498 assert ! ( can_have_local_instance( self . scx. tcx( ) , exchange_malloc_fn_def_id) ) ;
499+ let empty_substs = self . scx . empty_substs_for_def_id ( exchange_malloc_fn_def_id) ;
499500 let exchange_malloc_fn_trans_item =
500501 create_fn_trans_item ( self . scx . tcx ( ) ,
501502 exchange_malloc_fn_def_id,
502- self . scx . tcx ( ) . mk_substs ( Substs :: empty ( ) ) ,
503+ empty_substs ,
503504 self . param_substs ) ;
504505
505506 self . output . push ( exchange_malloc_fn_trans_item) ;
@@ -679,10 +680,11 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
679680 . unwrap_or_else ( |e| scx. sess ( ) . fatal ( & e) ) ;
680681
681682 assert ! ( can_have_local_instance( scx. tcx( ) , exchange_free_fn_def_id) ) ;
683+ let fn_substs = scx. empty_substs_for_def_id ( exchange_free_fn_def_id) ;
682684 let exchange_free_fn_trans_item =
683685 create_fn_trans_item ( scx. tcx ( ) ,
684686 exchange_free_fn_def_id,
685- scx . tcx ( ) . mk_substs ( Substs :: empty ( ) ) ,
687+ fn_substs ,
686688 scx. tcx ( ) . mk_substs ( Substs :: empty ( ) ) ) ;
687689
688690 output. push ( exchange_free_fn_trans_item) ;
@@ -1111,7 +1113,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
11111113 debug ! ( "RootCollector: ItemFn({})" ,
11121114 def_id_to_string( self . scx. tcx( ) , def_id) ) ;
11131115
1114- let instance = Instance :: mono ( self . scx . tcx ( ) , def_id) ;
1116+ let instance = Instance :: mono ( self . scx , def_id) ;
11151117 self . output . push ( TransItem :: Fn ( instance) ) ;
11161118 }
11171119 }
@@ -1148,7 +1150,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
11481150 debug ! ( "RootCollector: MethodImplItem({})" ,
11491151 def_id_to_string( self . scx. tcx( ) , def_id) ) ;
11501152
1151- let instance = Instance :: mono ( self . scx . tcx ( ) , def_id) ;
1153+ let instance = Instance :: mono ( self . scx , def_id) ;
11521154 self . output . push ( TransItem :: Fn ( instance) ) ;
11531155 }
11541156 }
0 commit comments