|
22 | 22 | //! [TypeRelation::a_is_expected], so when dealing with contravariance |
23 | 23 | //! this should be correctly updated. |
24 | 24 |
|
25 | | -use super::equate::Equate; |
26 | 25 | use super::glb::Glb; |
27 | 26 | use super::lub::Lub; |
28 | | -use super::sub::Sub; |
| 27 | +use super::type_relating::TypeRelating; |
29 | 28 | use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace}; |
30 | 29 | use crate::traits::{Obligation, PredicateObligations}; |
31 | 30 | use rustc_middle::infer::canonical::OriginalQueryValues; |
@@ -303,12 +302,12 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> { |
303 | 302 | self.infcx.tcx |
304 | 303 | } |
305 | 304 |
|
306 | | - pub fn equate<'a>(&'a mut self, a_is_expected: bool) -> Equate<'a, 'infcx, 'tcx> { |
307 | | - Equate::new(self, a_is_expected) |
| 305 | + pub fn equate<'a>(&'a mut self, a_is_expected: bool) -> TypeRelating<'a, 'infcx, 'tcx> { |
| 306 | + TypeRelating::new(self, a_is_expected, ty::Invariant) |
308 | 307 | } |
309 | 308 |
|
310 | | - pub fn sub<'a>(&'a mut self, a_is_expected: bool) -> Sub<'a, 'infcx, 'tcx> { |
311 | | - Sub::new(self, a_is_expected) |
| 309 | + pub fn sub<'a>(&'a mut self, a_is_expected: bool) -> TypeRelating<'a, 'infcx, 'tcx> { |
| 310 | + TypeRelating::new(self, a_is_expected, ty::Covariant) |
312 | 311 | } |
313 | 312 |
|
314 | 313 | pub fn lub<'a>(&'a mut self, a_is_expected: bool) -> Lub<'a, 'infcx, 'tcx> { |
@@ -345,17 +344,7 @@ pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> { |
345 | 344 |
|
346 | 345 | /// Register an obligation that both types must be related to each other according to |
347 | 346 | /// the [`ty::AliasRelationDirection`] given by [`ObligationEmittingRelation::alias_relate_direction`] |
348 | | - fn register_type_relate_obligation(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) { |
349 | | - self.register_predicates([ty::Binder::dummy(ty::PredicateKind::AliasRelate( |
350 | | - a.into(), |
351 | | - b.into(), |
352 | | - self.alias_relate_direction(), |
353 | | - ))]); |
354 | | - } |
355 | | - |
356 | | - /// Relation direction emitted for `AliasRelate` predicates, corresponding to the direction |
357 | | - /// of the relation. |
358 | | - fn alias_relate_direction(&self) -> ty::AliasRelationDirection; |
| 347 | + fn register_type_relate_obligation(&mut self, a: Ty<'tcx>, b: Ty<'tcx>); |
359 | 348 | } |
360 | 349 |
|
361 | 350 | fn int_unification_error<'tcx>( |
|
0 commit comments