1818//! On success, the LUB/GLB operations return the appropriate bound. The
1919//! return value of `Equate` or `Sub` shouldn't really be used.
2020
21+ pub use rustc_next_trait_solver::relate::combine::*;
22+
2123use super::glb::Glb;
2224use super::lub::Lub;
2325use super::type_relating::TypeRelating;
26+ use super::RelateResult;
2427use super::StructurallyRelateAliases;
25- use super::{RelateResult, TypeRelation};
2628use crate::infer::relate;
2729use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace};
2830use crate::traits::{Obligation, PredicateObligation};
@@ -32,7 +34,6 @@ use rustc_middle::traits::solve::Goal;
3234use rustc_middle::ty::error::{ExpectedFound, TypeError};
3335use rustc_middle::ty::{self, InferConst, Ty, TyCtxt, TypeVisitableExt, Upcast};
3436use rustc_middle::ty::{IntType, UintType};
35- use rustc_span::Span;
3637
3738#[derive(Clone)]
3839pub struct CombineFields<'infcx, 'tcx> {
@@ -76,7 +77,7 @@ impl<'tcx> InferCtxt<'tcx> {
7677 b: Ty<'tcx>,
7778 ) -> RelateResult<'tcx, Ty<'tcx>>
7879 where
79- R: PredicateEmittingRelation<'tcx>,
80+ R: PredicateEmittingRelation<InferCtxt< 'tcx> >,
8081 {
8182 debug_assert!(!a.has_escaping_bound_vars());
8283 debug_assert!(!b.has_escaping_bound_vars());
@@ -171,7 +172,7 @@ impl<'tcx> InferCtxt<'tcx> {
171172 b: ty::Const<'tcx>,
172173 ) -> RelateResult<'tcx, ty::Const<'tcx>>
173174 where
174- R: PredicateEmittingRelation<'tcx>,
175+ R: PredicateEmittingRelation<InferCtxt< 'tcx> >,
175176 {
176177 debug!("{}.consts({:?}, {:?})", relation.tag(), a, b);
177178 debug_assert!(!a.has_escaping_bound_vars());
@@ -323,30 +324,3 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
323324 )
324325 }
325326}
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