about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-10-10 14:56:24 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-10-15 16:05:31 -0400
commitca52427d06eaf7151f4381b9f4decff4490f6068 (patch)
treeb86ae270cdc2b656ed065e2689a27ee1e022e6b3
parent24bee005b646692b265af026cf863acf9a322460 (diff)
downloadrust-ca52427d06eaf7151f4381b9f4decff4490f6068.tar.gz
rust-ca52427d06eaf7151f4381b9f4decff4490f6068.zip
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.
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
index 96cc1c0afec..d4e047673d8 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs
@@ -32,7 +32,7 @@ pub(super) fn sub_types<'tcx>(
 ) -> Fallible<()> {
     debug!("sub_types(a={:?}, b={:?}, locations={:?})", a, b, locations);
     TypeRelating::new(
-        infcx.tcx,
+        infcx,
         NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category),
         ty::Variance::Covariant,
         ty::List::empty(),
@@ -51,7 +51,7 @@ pub(super) fn eq_types<'tcx>(
 ) -> Fallible<()> {
     debug!("eq_types(a={:?}, b={:?}, locations={:?})", a, b, locations);
     TypeRelating::new(
-        infcx.tcx,
+        infcx,
         NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category),
         ty::Variance::Invariant,
         ty::List::empty(),
@@ -86,7 +86,7 @@ pub(super) fn relate_type_and_user_type<'tcx>(
     let v1 = ty::Contravariant.xform(v);
 
     let mut type_relating = TypeRelating::new(
-        infcx.tcx,
+        infcx,
         NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category),
         v1,
         b_variables,
@@ -109,7 +109,7 @@ struct TypeRelating<'me, 'gcx: 'tcx, 'tcx: 'me, D>
 where
     D: TypeRelatingDelegate<'tcx>,
 {
-    tcx: TyCtxt<'me, 'gcx, 'tcx>,
+    infcx: &'me InferCtxt<'me, 'gcx, 'tcx>,
 
     /// Callback to use when we deduce an outlives relationship
     delegate: D,
@@ -276,14 +276,14 @@ where
     D: TypeRelatingDelegate<'tcx>,
 {
     fn new(
-        tcx: TyCtxt<'me, 'gcx, 'tcx>,
+        infcx: &'me InferCtxt<'me, 'gcx, 'tcx>,
         delegate: D,
         ambient_variance: ty::Variance,
         canonical_var_infos: CanonicalVarInfos<'tcx>,
     ) -> Self {
         let canonical_var_values = IndexVec::from_elem_n(None, canonical_var_infos.len());
         Self {
-            tcx,
+            infcx,
             delegate,
             ambient_variance,
             canonical_var_values,
@@ -432,7 +432,7 @@ where
 
     fn generalize_value(&mut self, kind: Kind<'tcx>) -> Kind<'tcx> {
         TypeGeneralizer {
-            tcx: self.tcx,
+            tcx: self.infcx.tcx,
             delegate: &mut self.delegate,
             first_free_index: ty::INNERMOST,
             ambient_variance: self.ambient_variance,
@@ -450,7 +450,7 @@ where
     D: TypeRelatingDelegate<'tcx>,
 {
     fn tcx(&self) -> TyCtxt<'me, 'gcx, 'tcx> {
-        self.tcx
+        self.infcx.tcx
     }
 
     fn tag(&self) -> &'static str {