1
- use rustc_data_structures:: sso:: SsoHashSet ;
2
1
use rustc_middle:: traits:: solve:: Goal ;
3
2
use rustc_middle:: ty:: relate:: {
4
3
Relate , RelateResult , TypeRelation , relate_args_invariantly, relate_args_with_variances,
5
4
} ;
6
5
use rustc_middle:: ty:: { self , Ty , TyCtxt , TyVar } ;
7
6
use rustc_span:: Span ;
7
+ use rustc_type_ir:: data_structures:: DelayedSet ;
8
8
use tracing:: { debug, instrument} ;
9
9
10
10
use super :: combine:: CombineFields ;
@@ -17,7 +17,7 @@ pub struct TypeRelating<'combine, 'a, 'tcx> {
17
17
fields : & ' combine mut CombineFields < ' a , ' tcx > ,
18
18
structurally_relate_aliases : StructurallyRelateAliases ,
19
19
ambient_variance : ty:: Variance ,
20
- cache : SsoHashSet < ( ty:: Variance , Ty < ' tcx > , Ty < ' tcx > ) > ,
20
+ cache : DelayedSet < ( ty:: Variance , Ty < ' tcx > , Ty < ' tcx > ) > ,
21
21
}
22
22
23
23
impl < ' combine , ' infcx , ' tcx > TypeRelating < ' combine , ' infcx , ' tcx > {
@@ -85,7 +85,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
85
85
let a = infcx. shallow_resolve ( a) ;
86
86
let b = infcx. shallow_resolve ( b) ;
87
87
88
- if infcx . next_trait_solver ( ) && self . cache . contains ( & ( self . ambient_variance , a, b) ) {
88
+ if self . cache . contains ( & ( self . ambient_variance , a, b) ) {
89
89
return Ok ( a) ;
90
90
}
91
91
@@ -171,9 +171,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
171
171
}
172
172
}
173
173
174
- if infcx. next_trait_solver ( ) {
175
- assert ! ( self . cache. insert( ( self . ambient_variance, a, b) ) ) ;
176
- }
174
+ assert ! ( self . cache. insert( ( self . ambient_variance, a, b) ) ) ;
177
175
178
176
Ok ( a)
179
177
}
0 commit comments