Skip to content

Commit

Permalink
Auto merge of #131191 - nnethercote:lattice_op, r=lcnr
Browse files Browse the repository at this point in the history
Merge `glb` and `lub` modules

Tons of code is duplicated across them, and it's easy to factor that out.

r? `@lcnr`
  • Loading branch information
bors committed Oct 4, 2024
2 parents e1e3cac + ee227de commit 7067e4a
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 403 deletions.
13 changes: 6 additions & 7 deletions compiler/rustc_infer/src/infer/relate/combine.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! There are four type combiners: [TypeRelating], [Lub], and [Glb],
//! There are four type combiners: [TypeRelating], `Lub`, and `Glb`,
//! and `NllTypeRelating` in rustc_borrowck, which is only used for NLL.
//!
//! Each implements the trait [TypeRelation] and contains methods for
Expand Down Expand Up @@ -26,8 +26,7 @@ use rustc_middle::ty::{self, InferConst, IntType, Ty, TyCtxt, TypeVisitableExt,
pub use rustc_next_trait_solver::relate::combine::*;
use tracing::debug;

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

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

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

pub fn register_obligations(
Expand Down
159 changes: 0 additions & 159 deletions compiler/rustc_infer/src/infer/relate/glb.rs

This file was deleted.

Loading

0 comments on commit 7067e4a

Please sign in to comment.