@@ -523,11 +523,17 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
523
523
// have to instantiate all methods of the trait being cast to, so we
524
524
// can build the appropriate vtable.
525
525
mir:: Rvalue :: Cast ( mir:: CastKind :: Unsize , ref operand, target_ty) => {
526
- let target_ty = self . tcx . trans_apply_param_substs ( self . param_substs ,
527
- & target_ty) ;
526
+ let target_ty = self . tcx . subst_and_normalize_erasing_regions (
527
+ self . param_substs ,
528
+ ty:: ParamEnv :: reveal_all ( ) ,
529
+ & target_ty,
530
+ ) ;
528
531
let source_ty = operand. ty ( self . mir , self . tcx ) ;
529
- let source_ty = self . tcx . trans_apply_param_substs ( self . param_substs ,
530
- & source_ty) ;
532
+ let source_ty = self . tcx . subst_and_normalize_erasing_regions (
533
+ self . param_substs ,
534
+ ty:: ParamEnv :: reveal_all ( ) ,
535
+ & source_ty,
536
+ ) ;
531
537
let ( source_ty, target_ty) = find_vtable_types_for_unsizing ( self . tcx ,
532
538
source_ty,
533
539
target_ty) ;
@@ -543,14 +549,20 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
543
549
}
544
550
mir:: Rvalue :: Cast ( mir:: CastKind :: ReifyFnPointer , ref operand, _) => {
545
551
let fn_ty = operand. ty ( self . mir , self . tcx ) ;
546
- let fn_ty = self . tcx . trans_apply_param_substs ( self . param_substs ,
547
- & fn_ty) ;
552
+ let fn_ty = self . tcx . subst_and_normalize_erasing_regions (
553
+ self . param_substs ,
554
+ ty:: ParamEnv :: reveal_all ( ) ,
555
+ & fn_ty,
556
+ ) ;
548
557
visit_fn_use ( self . tcx , fn_ty, false , & mut self . output ) ;
549
558
}
550
559
mir:: Rvalue :: Cast ( mir:: CastKind :: ClosureFnPointer , ref operand, _) => {
551
560
let source_ty = operand. ty ( self . mir , self . tcx ) ;
552
- let source_ty = self . tcx . trans_apply_param_substs ( self . param_substs ,
553
- & source_ty) ;
561
+ let source_ty = self . tcx . subst_and_normalize_erasing_regions (
562
+ self . param_substs ,
563
+ ty:: ParamEnv :: reveal_all ( ) ,
564
+ & source_ty,
565
+ ) ;
554
566
match source_ty. sty {
555
567
ty:: TyClosure ( def_id, substs) => {
556
568
let instance = monomorphize:: resolve_closure (
@@ -595,14 +607,22 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
595
607
match * kind {
596
608
mir:: TerminatorKind :: Call { ref func, .. } => {
597
609
let callee_ty = func. ty ( self . mir , tcx) ;
598
- let callee_ty = tcx. trans_apply_param_substs ( self . param_substs , & callee_ty) ;
610
+ let callee_ty = tcx. subst_and_normalize_erasing_regions (
611
+ self . param_substs ,
612
+ ty:: ParamEnv :: reveal_all ( ) ,
613
+ & callee_ty,
614
+ ) ;
599
615
visit_fn_use ( self . tcx , callee_ty, true , & mut self . output ) ;
600
616
}
601
617
mir:: TerminatorKind :: Drop { ref location, .. } |
602
618
mir:: TerminatorKind :: DropAndReplace { ref location, .. } => {
603
619
let ty = location. ty ( self . mir , self . tcx )
604
620
. to_ty ( self . tcx ) ;
605
- let ty = tcx. trans_apply_param_substs ( self . param_substs , & ty) ;
621
+ let ty = tcx. subst_and_normalize_erasing_regions (
622
+ self . param_substs ,
623
+ ty:: ParamEnv :: reveal_all ( ) ,
624
+ & ty,
625
+ ) ;
606
626
visit_drop_use ( self . tcx , ty, true , self . output ) ;
607
627
}
608
628
mir:: TerminatorKind :: Goto { .. } |
@@ -1155,8 +1175,11 @@ fn collect_const<'a, 'tcx>(
1155
1175
let val = match constant. val {
1156
1176
ConstVal :: Unevaluated ( def_id, substs) => {
1157
1177
let param_env = ty:: ParamEnv :: reveal_all ( ) ;
1158
- let substs = tcx. trans_apply_param_substs ( param_substs,
1159
- & substs) ;
1178
+ let substs = tcx. subst_and_normalize_erasing_regions (
1179
+ param_substs,
1180
+ param_env,
1181
+ & substs,
1182
+ ) ;
1160
1183
let instance = ty:: Instance :: resolve ( tcx,
1161
1184
param_env,
1162
1185
def_id,
0 commit comments