]> git.lizzy.rs Git - rust.git/commitdiff
infer: rename `region_vars` field to `region_constraints`
authorNiko Matsakis <niko@alum.mit.edu>
Sun, 5 Nov 2017 11:55:40 +0000 (06:55 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Thu, 16 Nov 2017 10:57:43 +0000 (05:57 -0500)
src/librustc/infer/equate.rs
src/librustc/infer/fudge.rs
src/librustc/infer/glb.rs
src/librustc/infer/higher_ranked/mod.rs
src/librustc/infer/lub.rs
src/librustc/infer/mod.rs
src/librustc/infer/resolve.rs
src/librustc/infer/sub.rs

index dbe3905a8c61944a6824161a856e411bf0f84b3e..0c59fa703bb667da8b708ea9567f68d59b2485b4 100644 (file)
@@ -104,7 +104,7 @@ fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
                a,
                b);
         let origin = Subtype(self.fields.trace.clone());
-        self.fields.infcx.region_vars.borrow_mut().make_eqregion(origin, a, b);
+        self.fields.infcx.region_constraints.borrow_mut().make_eqregion(origin, a, b);
         Ok(a)
     }
 
index b6637069408e05ad22b401829b82d18093fe981a..729e67437ba3e0b098e6cf0fdeb9fc677b73bfd1 100644 (file)
@@ -78,8 +78,8 @@ pub fn fudge_regions_if_ok<T, E, F>(&self,
                         self.type_variables.borrow_mut().types_created_since_snapshot(
                             &snapshot.type_snapshot);
                     let region_vars =
-                        self.region_vars.borrow().vars_created_since_snapshot(
-                            &snapshot.region_vars_snapshot);
+                        self.region_constraints.borrow().vars_created_since_snapshot(
+                            &snapshot.region_constraints_snapshot);
 
                     Ok((type_variables, region_vars, value))
                 }
index c0e1369410616131e52a8287b40e0726d41ce44f..d63036eecff9f11e406b9335f83feeeb62061807 100644 (file)
@@ -67,7 +67,7 @@ fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
                b);
 
         let origin = Subtype(self.fields.trace.clone());
-        Ok(self.fields.infcx.region_vars.borrow_mut().glb_regions(self.tcx(), origin, a, b))
+        Ok(self.fields.infcx.region_constraints.borrow_mut().glb_regions(self.tcx(), origin, a, b))
     }
 
     fn binders<T>(&mut self, a: &ty::Binder<T>, b: &ty::Binder<T>)
index 5f898856d31f0f1ece1bc38f48bd1b95fbf362e4..2aef9fece87a5aa9daf228826eff36110505b8d3 100644 (file)
@@ -176,7 +176,7 @@ pub fn higher_ranked_match<T, U>(&mut self,
                                      .filter(|&r| r != representative)
                 {
                     let origin = SubregionOrigin::Subtype(self.trace.clone());
-                    self.infcx.region_vars.borrow_mut().make_eqregion(origin,
+                    self.infcx.region_constraints.borrow_mut().make_eqregion(origin,
                                                                       *representative,
                                                                       *region);
                 }
@@ -427,7 +427,7 @@ fn rev_lookup<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
         fn fresh_bound_variable<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
                                                 debruijn: ty::DebruijnIndex)
                                                 -> ty::Region<'tcx> {
-            infcx.region_vars.borrow_mut().new_bound(infcx.tcx, debruijn)
+            infcx.region_constraints.borrow_mut().new_bound(infcx.tcx, debruijn)
         }
     }
 }
@@ -481,7 +481,11 @@ fn tainted_regions(&self,
                        r: ty::Region<'tcx>,
                        directions: TaintDirections)
                        -> FxHashSet<ty::Region<'tcx>> {
-        self.region_vars.borrow().tainted(self.tcx, &snapshot.region_vars_snapshot, r, directions)
+        self.region_constraints.borrow().tainted(
+            self.tcx,
+            &snapshot.region_constraints_snapshot,
+            r,
+            directions)
     }
 
     fn region_vars_confined_to_snapshot(&self,
@@ -539,7 +543,8 @@ fn region_vars_confined_to_snapshot(&self,
          */
 
         let mut region_vars =
-            self.region_vars.borrow().vars_created_since_snapshot(&snapshot.region_vars_snapshot);
+            self.region_constraints.borrow().vars_created_since_snapshot(
+                &snapshot.region_constraints_snapshot);
 
         let escaping_types =
             self.type_variables.borrow_mut().types_escaping_snapshot(&snapshot.type_snapshot);
@@ -581,9 +586,9 @@ pub fn skolemize_late_bound_regions<T>(&self,
         where T : TypeFoldable<'tcx>
     {
         let (result, map) = self.tcx.replace_late_bound_regions(binder, |br| {
-            self.region_vars.borrow_mut().push_skolemized(self.tcx,
+            self.region_constraints.borrow_mut().push_skolemized(self.tcx,
                                                           br,
-                                                          &snapshot.region_vars_snapshot)
+                                                          &snapshot.region_constraints_snapshot)
         });
 
         debug!("skolemize_bound_regions(binder={:?}, result={:?}, map={:?})",
@@ -768,9 +773,10 @@ pub fn pop_skolemized(&self,
     {
         debug!("pop_skolemized({:?})", skol_map);
         let skol_regions: FxHashSet<_> = skol_map.values().cloned().collect();
-        self.region_vars.borrow_mut().pop_skolemized(self.tcx,
-                                                     &skol_regions,
-                                                     &snapshot.region_vars_snapshot);
+        self.region_constraints.borrow_mut().pop_skolemized(
+            self.tcx,
+            &skol_regions,
+            &snapshot.region_constraints_snapshot);
         if !skol_map.is_empty() {
             self.projection_cache.borrow_mut().rollback_skolemized(
                 &snapshot.projection_cache_snapshot);
index e3a16ecb444ad0883eb6dc38107e9bd34332cf20..0c4f4efe9947ca41fdf165dc5ec5f1b20ef9698e 100644 (file)
@@ -67,7 +67,7 @@ fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
                b);
 
         let origin = Subtype(self.fields.trace.clone());
-        Ok(self.fields.infcx.region_vars.borrow_mut().lub_regions(self.tcx(), origin, a, b))
+        Ok(self.fields.infcx.region_constraints.borrow_mut().lub_regions(self.tcx(), origin, a, b))
     }
 
     fn binders<T>(&mut self, a: &ty::Binder<T>, b: &ty::Binder<T>)
index e5e6f292f68759f5ef97a9a058883c473fe17bf0..fe15f9acdb5a0b51dc949f1addf8f5d8e9a76c9d 100644 (file)
@@ -104,7 +104,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
     float_unification_table: RefCell<UnificationTable<ty::FloatVid>>,
 
     // For region variables.
-    region_constraints: RefCell<RegionConstraints<'tcx>>,
+    region_constraints: RefCell<RegionVarBindings<'tcx>>,
 
     // Once region inference is done, the values for each variable.
     lexical_region_resolutions: RefCell<Option<LexicalRegionResolutions<'tcx>>>,
@@ -424,7 +424,7 @@ pub fn enter<F, R>(&'tcx mut self, f: F) -> R
             type_variables: RefCell::new(type_variable::TypeVariableTable::new()),
             int_unification_table: RefCell::new(UnificationTable::new()),
             float_unification_table: RefCell::new(UnificationTable::new()),
-            region_vars: RefCell::new(RegionVarBindings::new()),
+            region_constraints: RefCell::new(RegionVarBindings::new()),
             lexical_region_resolutions: RefCell::new(None),
             selection_cache: traits::SelectionCache::new(),
             evaluation_cache: traits::EvaluationCache::new(),
@@ -459,7 +459,7 @@ pub struct CombinedSnapshot<'a, 'tcx:'a> {
     type_snapshot: type_variable::Snapshot,
     int_snapshot: unify::Snapshot<ty::IntVid>,
     float_snapshot: unify::Snapshot<ty::FloatVid>,
-    region_vars_snapshot: RegionSnapshot,
+    region_constraints_snapshot: RegionSnapshot,
     was_in_snapshot: bool,
     _in_progress_tables: Option<Ref<'a, ty::TypeckTables<'tcx>>>,
 }
@@ -767,7 +767,7 @@ fn start_snapshot<'b>(&'b self) -> CombinedSnapshot<'b, 'tcx> {
             type_snapshot: self.type_variables.borrow_mut().snapshot(),
             int_snapshot: self.int_unification_table.borrow_mut().snapshot(),
             float_snapshot: self.float_unification_table.borrow_mut().snapshot(),
-            region_vars_snapshot: self.region_vars.borrow_mut().start_snapshot(),
+            region_constraints_snapshot: self.region_constraints.borrow_mut().start_snapshot(),
             was_in_snapshot: in_snapshot,
             // Borrow tables "in progress" (i.e. during typeck)
             // to ban writes from within a snapshot to them.
@@ -783,7 +783,7 @@ fn rollback_to(&self, cause: &str, snapshot: CombinedSnapshot) {
                                type_snapshot,
                                int_snapshot,
                                float_snapshot,
-                               region_vars_snapshot,
+                               region_constraints_snapshot,
                                was_in_snapshot,
                                _in_progress_tables } = snapshot;
 
@@ -801,9 +801,9 @@ fn rollback_to(&self, cause: &str, snapshot: CombinedSnapshot) {
         self.float_unification_table
             .borrow_mut()
             .rollback_to(float_snapshot);
-        self.region_vars
+        self.region_constraints
             .borrow_mut()
-            .rollback_to(region_vars_snapshot);
+            .rollback_to(region_constraints_snapshot);
     }
 
     fn commit_from(&self, snapshot: CombinedSnapshot) {
@@ -812,7 +812,7 @@ fn commit_from(&self, snapshot: CombinedSnapshot) {
                                type_snapshot,
                                int_snapshot,
                                float_snapshot,
-                               region_vars_snapshot,
+                               region_constraints_snapshot,
                                was_in_snapshot,
                                _in_progress_tables } = snapshot;
 
@@ -830,9 +830,9 @@ fn commit_from(&self, snapshot: CombinedSnapshot) {
         self.float_unification_table
             .borrow_mut()
             .commit(float_snapshot);
-        self.region_vars
+        self.region_constraints
             .borrow_mut()
-            .commit(region_vars_snapshot);
+            .commit(region_constraints_snapshot);
     }
 
     /// Execute `f` and commit the bindings
@@ -887,7 +887,7 @@ pub fn add_given(&self,
                      sub: ty::Region<'tcx>,
                      sup: ty::RegionVid)
     {
-        self.region_vars.borrow_mut().add_given(sub, sup);
+        self.region_constraints.borrow_mut().add_given(sub, sup);
     }
 
     pub fn can_sub<T>(&self,
@@ -927,7 +927,7 @@ pub fn sub_regions(&self,
                        a: ty::Region<'tcx>,
                        b: ty::Region<'tcx>) {
         debug!("sub_regions({:?} <: {:?})", a, b);
-        self.region_vars.borrow_mut().make_subregion(origin, a, b);
+        self.region_constraints.borrow_mut().make_subregion(origin, a, b);
     }
 
     pub fn equality_predicate(&self,
@@ -1030,7 +1030,7 @@ pub fn next_float_var_id(&self) -> FloatVid {
 
     pub fn next_region_var(&self, origin: RegionVariableOrigin)
                            -> ty::Region<'tcx> {
-        self.tcx.mk_region(ty::ReVar(self.region_vars.borrow_mut().new_region_var(origin)))
+        self.tcx.mk_region(ty::ReVar(self.region_constraints.borrow_mut().new_region_var(origin)))
     }
 
     /// Create a region inference variable for the given
@@ -1127,7 +1127,7 @@ pub fn resolve_regions_and_report_errors(&self,
                                                region_map,
                                                free_regions);
         let (lexical_region_resolutions, errors) =
-            self.region_vars.borrow_mut().resolve_regions(&region_rels);
+            self.region_constraints.borrow_mut().resolve_regions(&region_rels);
 
         let old_value = self.lexical_region_resolutions.replace(Some(lexical_region_resolutions));
         assert!(old_value.is_none());
@@ -1365,7 +1365,7 @@ pub fn verify_generic_bound(&self,
                a,
                bound);
 
-        self.region_vars.borrow_mut().verify_generic_bound(origin, kind, a, bound);
+        self.region_constraints.borrow_mut().verify_generic_bound(origin, kind, a, bound);
     }
 
     pub fn type_moves_by_default(&self,
index 8a99eb08014325904ec9efbf2a76c38057cf9990..53d963832426bb7a2588a11e0eff3c0abdd6a495 100644 (file)
@@ -75,7 +75,8 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
     fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
         match *r {
             ty::ReVar(rid) =>
-                self.infcx.region_vars.borrow_mut().opportunistic_resolve_var(self.tcx(), rid),
+                self.infcx.region_constraints.borrow_mut()
+                                             .opportunistic_resolve_var(self.tcx(), rid),
             _ =>
                 r,
         }
index bba4328e6ea840caeb6bbdac63dde1b81377b064..bc4bb0c4712fa80bf4a6d1b6b108d380a342395b 100644 (file)
@@ -137,7 +137,7 @@ fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
         // from the "cause" field, we could perhaps give more tailored
         // error messages.
         let origin = SubregionOrigin::Subtype(self.fields.trace.clone());
-        self.fields.infcx.region_vars.borrow_mut().make_subregion(origin, a, b);
+        self.fields.infcx.region_constraints.borrow_mut().make_subregion(origin, a, b);
 
         Ok(a)
     }