21
21
use super :: glb:: Glb ;
22
22
use super :: lub:: Lub ;
23
23
use super :: type_relating:: TypeRelating ;
24
- use super :: StructurallyRelateAliases ;
25
- use super :: { RelateResult , TypeRelation } ;
26
- use crate :: infer :: relate ;
24
+ use crate :: infer :: relate :: {
25
+ self , PredicateEmittingRelation , RelateResult , StructurallyRelateAliases ,
26
+ } ;
27
27
use crate :: infer:: { DefineOpaqueTypes , InferCtxt , TypeTrace } ;
28
28
use crate :: traits:: { Obligation , PredicateObligation } ;
29
29
use rustc_middle:: bug;
@@ -32,7 +32,6 @@ use rustc_middle::traits::solve::Goal;
32
32
use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
33
33
use rustc_middle:: ty:: { self , InferConst , Ty , TyCtxt , TypeVisitableExt , Upcast } ;
34
34
use rustc_middle:: ty:: { IntType , UintType } ;
35
- use rustc_span:: Span ;
36
35
37
36
#[ derive( Clone ) ]
38
37
pub struct CombineFields < ' infcx , ' tcx > {
@@ -76,7 +75,7 @@ impl<'tcx> InferCtxt<'tcx> {
76
75
b : Ty < ' tcx > ,
77
76
) -> RelateResult < ' tcx , Ty < ' tcx > >
78
77
where
79
- R : PredicateEmittingRelation < ' tcx > ,
78
+ R : PredicateEmittingRelation < TyCtxt < ' tcx > > ,
80
79
{
81
80
debug_assert ! ( !a. has_escaping_bound_vars( ) ) ;
82
81
debug_assert ! ( !b. has_escaping_bound_vars( ) ) ;
@@ -171,7 +170,7 @@ impl<'tcx> InferCtxt<'tcx> {
171
170
b : ty:: Const < ' tcx > ,
172
171
) -> RelateResult < ' tcx , ty:: Const < ' tcx > >
173
172
where
174
- R : PredicateEmittingRelation < ' tcx > ,
173
+ R : PredicateEmittingRelation < TyCtxt < ' tcx > > ,
175
174
{
176
175
debug ! ( "{}.consts({:?}, {:?})" , relation. tag( ) , a, b) ;
177
176
debug_assert ! ( !a. has_escaping_bound_vars( ) ) ;
@@ -323,30 +322,3 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
323
322
)
324
323
}
325
324
}
326
-
327
- pub trait PredicateEmittingRelation < ' tcx > : TypeRelation < TyCtxt < ' tcx > > {
328
- fn span ( & self ) -> Span ;
329
-
330
- fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > ;
331
-
332
- /// Whether aliases should be related structurally. This is pretty much
333
- /// always `No` unless you're equating in some specific locations of the
334
- /// new solver. See the comments in these use-cases for more details.
335
- fn structurally_relate_aliases ( & self ) -> StructurallyRelateAliases ;
336
-
337
- /// Register obligations that must hold in order for this relation to hold
338
- fn register_goals (
339
- & mut self ,
340
- obligations : impl IntoIterator < Item = Goal < ' tcx , ty:: Predicate < ' tcx > > > ,
341
- ) ;
342
-
343
- /// Register predicates that must hold in order for this relation to hold.
344
- /// This uses the default `param_env` of the obligation.
345
- fn register_predicates (
346
- & mut self ,
347
- obligations : impl IntoIterator < Item : Upcast < TyCtxt < ' tcx > , ty:: Predicate < ' tcx > > > ,
348
- ) ;
349
-
350
- /// Register `AliasRelate` obligation(s) that both types must be related to each other.
351
- fn register_alias_relate_predicate ( & mut self , a : Ty < ' tcx > , b : Ty < ' tcx > ) ;
352
- }
0 commit comments