@@ -22,13 +22,14 @@ use super::glb::Glb;
22
22
use super :: lub:: Lub ;
23
23
use super :: type_relating:: TypeRelating ;
24
24
use super :: StructurallyRelateAliases ;
25
+ use super :: { RelateResult , TypeRelation } ;
26
+ use crate :: infer:: relate;
25
27
use crate :: infer:: { DefineOpaqueTypes , InferCtxt , InferOk , TypeTrace } ;
26
28
use crate :: traits:: { Obligation , PredicateObligations } ;
27
29
use rustc_middle:: bug;
28
30
use rustc_middle:: infer:: unify_key:: EffectVarValue ;
29
31
use rustc_middle:: traits:: ObligationCause ;
30
32
use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
31
- use rustc_middle:: ty:: relate:: { RelateResult , TypeRelation } ;
32
33
use rustc_middle:: ty:: { self , InferConst , Ty , TyCtxt , TypeVisitableExt , Upcast } ;
33
34
use rustc_middle:: ty:: { IntType , UintType } ;
34
35
use rustc_span:: Span ;
@@ -124,7 +125,7 @@ impl<'tcx> InferCtxt<'tcx> {
124
125
( _, ty:: Alias ( ..) ) | ( ty:: Alias ( ..) , _) if self . next_trait_solver ( ) => {
125
126
match relation. structurally_relate_aliases ( ) {
126
127
StructurallyRelateAliases :: Yes => {
127
- ty :: relate:: structurally_relate_tys ( relation, a, b)
128
+ relate:: structurally_relate_tys ( relation, a, b)
128
129
}
129
130
StructurallyRelateAliases :: No => {
130
131
relation. register_type_relate_obligation ( a, b) ;
@@ -135,7 +136,7 @@ impl<'tcx> InferCtxt<'tcx> {
135
136
136
137
// All other cases of inference are errors
137
138
( & ty:: Infer ( _) , _) | ( _, & ty:: Infer ( _) ) => {
138
- Err ( TypeError :: Sorts ( ty :: relate :: expected_found ( a, b) ) )
139
+ Err ( TypeError :: Sorts ( ExpectedFound :: new ( true , a, b) ) )
139
140
}
140
141
141
142
// During coherence, opaque types should be treated as *possibly*
@@ -147,7 +148,7 @@ impl<'tcx> InferCtxt<'tcx> {
147
148
Ok ( a)
148
149
}
149
150
150
- _ => ty :: relate:: structurally_relate_tys ( relation, a, b) ,
151
+ _ => relate:: structurally_relate_tys ( relation, a, b) ,
151
152
}
152
153
}
153
154
@@ -243,11 +244,11 @@ impl<'tcx> InferCtxt<'tcx> {
243
244
Ok ( b)
244
245
}
245
246
StructurallyRelateAliases :: Yes => {
246
- ty :: relate:: structurally_relate_consts ( relation, a, b)
247
+ relate:: structurally_relate_consts ( relation, a, b)
247
248
}
248
249
}
249
250
}
250
- _ => ty :: relate:: structurally_relate_consts ( relation, a, b) ,
251
+ _ => relate:: structurally_relate_consts ( relation, a, b) ,
251
252
}
252
253
}
253
254
@@ -333,7 +334,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
333
334
}
334
335
}
335
336
336
- pub trait ObligationEmittingRelation < ' tcx > : TypeRelation < ' tcx > {
337
+ pub trait ObligationEmittingRelation < ' tcx > : TypeRelation < InferCtxt < ' tcx > > {
337
338
fn span ( & self ) -> Span ;
338
339
339
340
fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > ;
0 commit comments