18
18
//! On success, the LUB/GLB operations return the appropriate bound. The
19
19
//! return value of `Equate` or `Sub` shouldn't really be used.
20
20
21
+ pub use rustc_next_trait_solver:: relate:: combine:: * ;
22
+
21
23
use super :: glb:: Glb ;
22
24
use super :: lub:: Lub ;
23
25
use super :: type_relating:: TypeRelating ;
26
+ use super :: RelateResult ;
24
27
use super :: StructurallyRelateAliases ;
25
- use super :: { RelateResult , TypeRelation } ;
26
28
use crate :: infer:: relate;
27
29
use crate :: infer:: { DefineOpaqueTypes , InferCtxt , TypeTrace } ;
28
30
use crate :: traits:: { Obligation , PredicateObligation } ;
@@ -32,7 +34,6 @@ use rustc_middle::traits::solve::Goal;
32
34
use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
33
35
use rustc_middle:: ty:: { self , InferConst , Ty , TyCtxt , TypeVisitableExt , Upcast } ;
34
36
use rustc_middle:: ty:: { IntType , UintType } ;
35
- use rustc_span:: Span ;
36
37
37
38
#[ derive( Clone ) ]
38
39
pub struct CombineFields < ' infcx , ' tcx > {
@@ -76,7 +77,7 @@ impl<'tcx> InferCtxt<'tcx> {
76
77
b : Ty < ' tcx > ,
77
78
) -> RelateResult < ' tcx , Ty < ' tcx > >
78
79
where
79
- R : PredicateEmittingRelation < ' tcx > ,
80
+ R : PredicateEmittingRelation < InferCtxt < ' tcx > > ,
80
81
{
81
82
debug_assert ! ( !a. has_escaping_bound_vars( ) ) ;
82
83
debug_assert ! ( !b. has_escaping_bound_vars( ) ) ;
@@ -171,7 +172,7 @@ impl<'tcx> InferCtxt<'tcx> {
171
172
b : ty:: Const < ' tcx > ,
172
173
) -> RelateResult < ' tcx , ty:: Const < ' tcx > >
173
174
where
174
- R : PredicateEmittingRelation < ' tcx > ,
175
+ R : PredicateEmittingRelation < InferCtxt < ' tcx > > ,
175
176
{
176
177
debug ! ( "{}.consts({:?}, {:?})" , relation. tag( ) , a, b) ;
177
178
debug_assert ! ( !a. has_escaping_bound_vars( ) ) ;
@@ -323,30 +324,3 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
323
324
)
324
325
}
325
326
}
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