Skip to content

Commit ca52427

Browse files
committed
make TypeRelating take an infcx again
At some point, I had thought to use this code to handle equality comparisons for the `IfEq` verify bounds; at that point, we might not have had an infcx to talk about. But we wound up doing "SCC representatives" instead, so that's fine.
1 parent 24bee00 commit ca52427

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub(super) fn sub_types<'tcx>(
3232
) -> Fallible<()> {
3333
debug!("sub_types(a={:?}, b={:?}, locations={:?})", a, b, locations);
3434
TypeRelating::new(
35-
infcx.tcx,
35+
infcx,
3636
NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category),
3737
ty::Variance::Covariant,
3838
ty::List::empty(),
@@ -51,7 +51,7 @@ pub(super) fn eq_types<'tcx>(
5151
) -> Fallible<()> {
5252
debug!("eq_types(a={:?}, b={:?}, locations={:?})", a, b, locations);
5353
TypeRelating::new(
54-
infcx.tcx,
54+
infcx,
5555
NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category),
5656
ty::Variance::Invariant,
5757
ty::List::empty(),
@@ -86,7 +86,7 @@ pub(super) fn relate_type_and_user_type<'tcx>(
8686
let v1 = ty::Contravariant.xform(v);
8787

8888
let mut type_relating = TypeRelating::new(
89-
infcx.tcx,
89+
infcx,
9090
NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category),
9191
v1,
9292
b_variables,
@@ -109,7 +109,7 @@ struct TypeRelating<'me, 'gcx: 'tcx, 'tcx: 'me, D>
109109
where
110110
D: TypeRelatingDelegate<'tcx>,
111111
{
112-
tcx: TyCtxt<'me, 'gcx, 'tcx>,
112+
infcx: &'me InferCtxt<'me, 'gcx, 'tcx>,
113113

114114
/// Callback to use when we deduce an outlives relationship
115115
delegate: D,
@@ -276,14 +276,14 @@ where
276276
D: TypeRelatingDelegate<'tcx>,
277277
{
278278
fn new(
279-
tcx: TyCtxt<'me, 'gcx, 'tcx>,
279+
infcx: &'me InferCtxt<'me, 'gcx, 'tcx>,
280280
delegate: D,
281281
ambient_variance: ty::Variance,
282282
canonical_var_infos: CanonicalVarInfos<'tcx>,
283283
) -> Self {
284284
let canonical_var_values = IndexVec::from_elem_n(None, canonical_var_infos.len());
285285
Self {
286-
tcx,
286+
infcx,
287287
delegate,
288288
ambient_variance,
289289
canonical_var_values,
@@ -432,7 +432,7 @@ where
432432

433433
fn generalize_value(&mut self, kind: Kind<'tcx>) -> Kind<'tcx> {
434434
TypeGeneralizer {
435-
tcx: self.tcx,
435+
tcx: self.infcx.tcx,
436436
delegate: &mut self.delegate,
437437
first_free_index: ty::INNERMOST,
438438
ambient_variance: self.ambient_variance,
@@ -450,7 +450,7 @@ where
450450
D: TypeRelatingDelegate<'tcx>,
451451
{
452452
fn tcx(&self) -> TyCtxt<'me, 'gcx, 'tcx> {
453-
self.tcx
453+
self.infcx.tcx
454454
}
455455

456456
fn tag(&self) -> &'static str {

0 commit comments

Comments
 (0)