@@ -70,7 +70,7 @@ use rustc_middle::ty::{
70
70
self ,
71
71
error:: TypeError ,
72
72
subst:: { GenericArgKind , Subst , SubstsRef } ,
73
- Binder , List , Region , Ty , TyCtxt , TypeFoldable ,
73
+ Binder , EarlyBinder , List , Region , Ty , TyCtxt , TypeFoldable ,
74
74
} ;
75
75
use rustc_span:: { sym, BytePos , DesugaringKind , Pos , Span } ;
76
76
use rustc_target:: spec:: abi;
@@ -961,12 +961,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
961
961
for ( def_id, actual) in iter:: zip ( default_params, substs. iter ( ) . rev ( ) ) {
962
962
match actual. unpack ( ) {
963
963
GenericArgKind :: Const ( c) => {
964
- if self . tcx . const_param_default ( def_id) . subst ( self . tcx , substs) != c {
964
+ if EarlyBinder ( self . tcx . const_param_default ( def_id) ) . subst ( self . tcx , substs)
965
+ != c
966
+ {
965
967
break ;
966
968
}
967
969
}
968
970
GenericArgKind :: Type ( ty) => {
969
- if self . tcx . type_of ( def_id) . subst ( self . tcx , substs) != ty {
971
+ if EarlyBinder ( self . tcx . type_of ( def_id) ) . subst ( self . tcx , substs) != ty {
970
972
break ;
971
973
}
972
974
}
@@ -1383,8 +1385,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1383
1385
}
1384
1386
1385
1387
( ty:: FnDef ( did1, substs1) , ty:: FnDef ( did2, substs2) ) => {
1386
- let sig1 = self . tcx . fn_sig ( * did1) . subst ( self . tcx , substs1) ;
1387
- let sig2 = self . tcx . fn_sig ( * did2) . subst ( self . tcx , substs2) ;
1388
+ let sig1 = EarlyBinder ( self . tcx . fn_sig ( * did1) ) . subst ( self . tcx , substs1) ;
1389
+ let sig2 = EarlyBinder ( self . tcx . fn_sig ( * did2) ) . subst ( self . tcx , substs2) ;
1388
1390
let mut values = self . cmp_fn_sig ( & sig1, & sig2) ;
1389
1391
let path1 = format ! ( " {{{}}}" , self . tcx. def_path_str_with_substs( * did1, substs1) ) ;
1390
1392
let path2 = format ! ( " {{{}}}" , self . tcx. def_path_str_with_substs( * did2, substs2) ) ;
@@ -1395,7 +1397,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1395
1397
}
1396
1398
1397
1399
( ty:: FnDef ( did1, substs1) , ty:: FnPtr ( sig2) ) => {
1398
- let sig1 = self . tcx . fn_sig ( * did1) . subst ( self . tcx , substs1) ;
1400
+ let sig1 = EarlyBinder ( self . tcx . fn_sig ( * did1) ) . subst ( self . tcx , substs1) ;
1399
1401
let mut values = self . cmp_fn_sig ( & sig1, sig2) ;
1400
1402
values. 0 . push_highlighted ( format ! (
1401
1403
" {{{}}}" ,
@@ -1405,7 +1407,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1405
1407
}
1406
1408
1407
1409
( ty:: FnPtr ( sig1) , ty:: FnDef ( did2, substs2) ) => {
1408
- let sig2 = self . tcx . fn_sig ( * did2) . subst ( self . tcx , substs2) ;
1410
+ let sig2 = EarlyBinder ( self . tcx . fn_sig ( * did2) ) . subst ( self . tcx , substs2) ;
1409
1411
let mut values = self . cmp_fn_sig ( sig1, & sig2) ;
1410
1412
values. 1 . push_normal ( format ! (
1411
1413
" {{{}}}" ,
@@ -1850,7 +1852,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1850
1852
let bounds = self . tcx . explicit_item_bounds ( * def_id) ;
1851
1853
1852
1854
for ( predicate, _) in bounds {
1853
- let predicate = predicate. subst ( self . tcx , substs) ;
1855
+ let predicate = EarlyBinder ( * predicate) . subst ( self . tcx , substs) ;
1854
1856
let output = predicate
1855
1857
. kind ( )
1856
1858
. map_bound ( |kind| match kind {
0 commit comments