Skip to content

Commit 7067e4a

Browse files
committed
Auto merge of rust-lang#131191 - nnethercote:lattice_op, r=lcnr
Merge `glb` and `lub` modules Tons of code is duplicated across them, and it's easy to factor that out. r? `@lcnr`
2 parents e1e3cac + ee227de commit 7067e4a

File tree

5 files changed

+231
-403
lines changed

5 files changed

+231
-403
lines changed

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! There are four type combiners: [TypeRelating], [Lub], and [Glb],
1+
//! There are four type combiners: [TypeRelating], `Lub`, and `Glb`,
22
//! and `NllTypeRelating` in rustc_borrowck, which is only used for NLL.
33
//!
44
//! Each implements the trait [TypeRelation] and contains methods for
@@ -26,8 +26,7 @@ use rustc_middle::ty::{self, InferConst, IntType, Ty, TyCtxt, TypeVisitableExt,
2626
pub use rustc_next_trait_solver::relate::combine::*;
2727
use tracing::debug;
2828

29-
use super::glb::Glb;
30-
use super::lub::Lub;
29+
use super::lattice::{LatticeOp, LatticeOpKind};
3130
use super::type_relating::TypeRelating;
3231
use super::{RelateResult, StructurallyRelateAliases};
3332
use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace, relate};
@@ -303,12 +302,12 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
303302
TypeRelating::new(self, StructurallyRelateAliases::No, ty::Contravariant)
304303
}
305304

306-
pub fn lub<'a>(&'a mut self) -> Lub<'a, 'infcx, 'tcx> {
307-
Lub::new(self)
305+
pub(crate) fn lub<'a>(&'a mut self) -> LatticeOp<'a, 'infcx, 'tcx> {
306+
LatticeOp::new(self, LatticeOpKind::Lub)
308307
}
309308

310-
pub fn glb<'a>(&'a mut self) -> Glb<'a, 'infcx, 'tcx> {
311-
Glb::new(self)
309+
pub(crate) fn glb<'a>(&'a mut self) -> LatticeOp<'a, 'infcx, 'tcx> {
310+
LatticeOp::new(self, LatticeOpKind::Glb)
312311
}
313312

314313
pub fn register_obligations(

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

-159
This file was deleted.

0 commit comments

Comments
 (0)