Skip to content

Commit 8715bfb

Browse files
Make super combine into fns
1 parent a4cd220 commit 8715bfb

File tree

5 files changed

+193
-202
lines changed

5 files changed

+193
-202
lines changed

compiler/rustc_borrowck/src/type_check/relate_tys.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_middle::span_bug;
1111
use rustc_middle::traits::ObligationCause;
1212
use rustc_middle::traits::query::NoSolution;
1313
use rustc_middle::ty::fold::FnMutDelegate;
14-
use rustc_middle::ty::relate::combine::InferCtxtCombineExt;
14+
use rustc_middle::ty::relate::combine::{super_combine_consts, super_combine_tys};
1515
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
1616
use rustc_span::symbol::sym;
1717
use rustc_span::{Span, Symbol};
@@ -363,7 +363,7 @@ impl<'b, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'b, 'tcx> {
363363
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
364364
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
365365
) if a_def_id == b_def_id || infcx.next_trait_solver() => {
366-
infcx.super_combine_tys(self, a, b).map(|_| ()).or_else(|err| {
366+
super_combine_tys(&infcx.infcx, self, a, b).map(|_| ()).or_else(|err| {
367367
// This behavior is only there for the old solver, the new solver
368368
// shouldn't ever fail. Instead, it unconditionally emits an
369369
// alias-relate goal.
@@ -386,7 +386,7 @@ impl<'b, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'b, 'tcx> {
386386
debug!(?a, ?b, ?self.ambient_variance);
387387

388388
// Will also handle unification of `IntVar` and `FloatVar`.
389-
self.type_checker.infcx.super_combine_tys(self, a, b)?;
389+
super_combine_tys(&self.type_checker.infcx.infcx, self, a, b)?;
390390
}
391391
}
392392

@@ -423,7 +423,7 @@ impl<'b, 'tcx> TypeRelation<TyCtxt<'tcx>> for NllTypeRelating<'_, 'b, 'tcx> {
423423
assert!(!a.has_non_region_infer(), "unexpected inference var {:?}", a);
424424
assert!(!b.has_non_region_infer(), "unexpected inference var {:?}", b);
425425

426-
self.type_checker.infcx.super_combine_consts(self, a, b)
426+
super_combine_consts(&self.type_checker.infcx.infcx, self, a, b)
427427
}
428428

429429
#[instrument(skip(self), level = "trace")]

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! [lattices]: https://en.wikipedia.org/wiki/Lattice_(order)
1919
2020
use rustc_middle::traits::solve::Goal;
21-
use rustc_middle::ty::relate::combine::InferCtxtCombineExt;
21+
use rustc_middle::ty::relate::combine::{super_combine_consts, super_combine_tys};
2222
use rustc_middle::ty::relate::{Relate, RelateResult, TypeRelation};
2323
use rustc_middle::ty::{self, Ty, TyCtxt, TyVar, TypeVisitableExt};
2424
use rustc_span::Span;
@@ -149,7 +149,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for LatticeOp<'_, 'tcx> {
149149
(
150150
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
151151
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
152-
) if a_def_id == b_def_id => infcx.super_combine_tys(self, a, b),
152+
) if a_def_id == b_def_id => super_combine_tys(infcx, self, a, b),
153153

154154
(&ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }), _)
155155
| (_, &ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }))
@@ -164,7 +164,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for LatticeOp<'_, 'tcx> {
164164
Ok(a)
165165
}
166166

167-
_ => infcx.super_combine_tys(self, a, b),
167+
_ => super_combine_tys(infcx, self, a, b),
168168
}
169169
}
170170

@@ -192,7 +192,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for LatticeOp<'_, 'tcx> {
192192
a: ty::Const<'tcx>,
193193
b: ty::Const<'tcx>,
194194
) -> RelateResult<'tcx, ty::Const<'tcx>> {
195-
self.infcx.super_combine_consts(self, a, b)
195+
super_combine_consts(self.infcx, self, a, b)
196196
}
197197

198198
fn binders<T>(

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_middle::traits::solve::Goal;
2-
use rustc_middle::ty::relate::combine::InferCtxtCombineExt;
2+
use rustc_middle::ty::relate::combine::{super_combine_consts, super_combine_tys};
33
use rustc_middle::ty::relate::{
44
Relate, RelateResult, TypeRelation, relate_args_invariantly, relate_args_with_variances,
55
};
@@ -186,7 +186,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, 'tcx> {
186186
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
187187
&ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),
188188
) if a_def_id == b_def_id => {
189-
infcx.super_combine_tys(self, a, b)?;
189+
super_combine_tys(infcx, self, a, b)?;
190190
}
191191

192192
(&ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }), _)
@@ -202,7 +202,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, 'tcx> {
202202
}
203203

204204
_ => {
205-
infcx.super_combine_tys(self, a, b)?;
205+
super_combine_tys(infcx, self, a, b)?;
206206
}
207207
}
208208

@@ -257,7 +257,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, 'tcx> {
257257
a: ty::Const<'tcx>,
258258
b: ty::Const<'tcx>,
259259
) -> RelateResult<'tcx, ty::Const<'tcx>> {
260-
self.infcx.super_combine_consts(self, a, b)
260+
super_combine_consts(self.infcx, self, a, b)
261261
}
262262

263263
fn binders<T>(

0 commit comments

Comments
 (0)