Skip to content

Commit 9c4a009

Browse files
Combine Eq and Sub
1 parent 865a168 commit 9c4a009

File tree

4 files changed

+104
-257
lines changed

4 files changed

+104
-257
lines changed

compiler/rustc_infer/src/infer/relate/combine.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
//! [TypeRelation::a_is_expected], so when dealing with contravariance
2323
//! this should be correctly updated.
2424
25-
use super::equate::Equate;
2625
use super::glb::Glb;
2726
use super::lub::Lub;
28-
use super::sub::Sub;
27+
use super::type_relating::TypeRelating;
2928
use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace};
3029
use crate::traits::{Obligation, PredicateObligations};
3130
use rustc_middle::infer::canonical::OriginalQueryValues;
@@ -34,7 +33,6 @@ use rustc_middle::ty::error::{ExpectedFound, TypeError};
3433
use rustc_middle::ty::relate::{RelateResult, TypeRelation};
3534
use rustc_middle::ty::{self, InferConst, ToPredicate, Ty, TyCtxt, TypeVisitableExt};
3635
use rustc_middle::ty::{IntType, UintType};
37-
use rustc_middle::ty::{RelationDirection, TyVar};
3836
use rustc_span::Span;
3937

4038
#[derive(Clone)]
@@ -304,12 +302,12 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
304302
self.infcx.tcx
305303
}
306304

307-
pub fn equate<'a>(&'a mut self, a_is_expected: bool) -> Equate<'a, 'infcx, 'tcx> {
308-
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::RelationDirection::Equate)
309307
}
310308

311-
pub fn sub<'a>(&'a mut self, a_is_expected: bool) -> Sub<'a, 'infcx, 'tcx> {
312-
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::RelationDirection::Subtype)
313311
}
314312

315313
pub fn lub<'a>(&'a mut self, a_is_expected: bool) -> Lub<'a, 'infcx, 'tcx> {

compiler/rustc_infer/src/infer/relate/equate.rs

-198
This file was deleted.

compiler/rustc_infer/src/infer/relate/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
//! (except for some relations used for diagnostics and heuristics in the compiler).
33
44
pub(super) mod combine;
5-
mod equate;
65
mod generalize;
76
mod glb;
87
mod higher_ranked;
98
mod lattice;
109
mod lub;
11-
mod sub;
10+
pub mod nll;
11+
mod type_relating;

0 commit comments

Comments
 (0)