From 326ec52eacf34a0a446ca1775e514cf7e6016de4 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 5 Nov 2017 07:01:48 -0500 Subject: [PATCH] rename RegionVarBindings to RegionConstraintCollector --- .../infer/lexical_region_resolve/graphviz.rs | 6 ++--- .../infer/lexical_region_resolve/mod.rs | 8 +++---- src/librustc/infer/mod.rs | 6 ++--- src/librustc/infer/region_constraints/mod.rs | 24 +++++++++---------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/librustc/infer/lexical_region_resolve/graphviz.rs b/src/librustc/infer/lexical_region_resolve/graphviz.rs index baf7f0aac3df..880c0e229474 100644 --- a/src/librustc/infer/lexical_region_resolve/graphviz.rs +++ b/src/librustc/infer/lexical_region_resolve/graphviz.rs @@ -25,7 +25,7 @@ use middle::free_region::RegionRelations; use middle::region; use super::Constraint; use infer::SubregionOrigin; -use infer::region_constraints::RegionVarBindings; +use infer::region_constraints::RegionConstraintCollector; use util::nodemap::{FxHashMap, FxHashSet}; use std::borrow::Cow; @@ -57,7 +57,7 @@ graphs will be printed. \n\ } pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>( - region_vars: &RegionVarBindings<'tcx>, + region_constraints: &RegionConstraintCollector<'tcx>, region_rels: &RegionRelations<'a, 'gcx, 'tcx>) { let tcx = region_rels.tcx; @@ -113,7 +113,7 @@ pub fn maybe_print_constraints_for<'a, 'gcx, 'tcx>( } }; - match dump_region_constraints_to(region_rels, ®ion_vars.constraints, &output_path) { + match dump_region_constraints_to(region_rels, ®ion_constraints.constraints, &output_path) { Ok(()) => {} Err(e) => { let msg = format!("io error dumping region constraints: {}", e); diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index aeeacfb132a6..9a02b274b5fb 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -14,7 +14,7 @@ use infer::SubregionOrigin; use infer::RegionVariableOrigin; use infer::region_constraints::Constraint; use infer::region_constraints::GenericKind; -use infer::region_constraints::RegionVarBindings; +use infer::region_constraints::RegionConstraintCollector; use infer::region_constraints::VerifyBound; use middle::free_region::RegionRelations; use rustc_data_structures::fx::FxHashSet; @@ -73,7 +73,7 @@ struct RegionAndOrigin<'tcx> { type RegionGraph<'tcx> = graph::Graph<(), Constraint<'tcx>>; -impl<'tcx> RegionVarBindings<'tcx> { +impl<'tcx> RegionConstraintCollector<'tcx> { /// This function performs the actual region resolution. It must be /// called after all constraints have been added. It performs a /// fixed-point iteration to find region values which satisfy all @@ -86,7 +86,7 @@ impl<'tcx> RegionVarBindings<'tcx> { LexicalRegionResolutions<'tcx>, Vec>, ) { - debug!("RegionVarBindings: resolve_regions()"); + debug!("RegionConstraintCollector: resolve_regions()"); let mut errors = vec![]; let values = self.infer_variable_values(region_rels, &mut errors); (values, errors) @@ -642,7 +642,7 @@ impl<'tcx> RegionVarBindings<'tcx> { return (result, dup_found); fn process_edges<'tcx>( - this: &RegionVarBindings<'tcx>, + this: &RegionConstraintCollector<'tcx>, state: &mut WalkState<'tcx>, graph: &RegionGraph<'tcx>, source_vid: RegionVid, diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index fe15f9acdb5a..d42419d7dc64 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -41,7 +41,7 @@ use arena::DroplessArena; use self::combine::CombineFields; use self::higher_ranked::HrMatchResult; -use self::region_constraints::{RegionVarBindings, RegionSnapshot}; +use self::region_constraints::{RegionConstraintCollector, RegionSnapshot}; use self::lexical_region_resolve::LexicalRegionResolutions; use self::type_variable::TypeVariableOrigin; use self::unify_key::ToType; @@ -104,7 +104,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { float_unification_table: RefCell>, // For region variables. - region_constraints: RefCell>, + region_constraints: RefCell>, // Once region inference is done, the values for each variable. lexical_region_resolutions: RefCell>>, @@ -424,7 +424,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> { type_variables: RefCell::new(type_variable::TypeVariableTable::new()), int_unification_table: RefCell::new(UnificationTable::new()), float_unification_table: RefCell::new(UnificationTable::new()), - region_constraints: RefCell::new(RegionVarBindings::new()), + region_constraints: RefCell::new(RegionConstraintCollector::new()), lexical_region_resolutions: RefCell::new(None), selection_cache: traits::SelectionCache::new(), evaluation_cache: traits::EvaluationCache::new(), diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 0731a2cfed6c..446acac4fd18 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -143,7 +143,7 @@ enum CombineMapType { type CombineMap<'tcx> = FxHashMap, RegionVid>; -pub struct RegionVarBindings<'tcx> { +pub struct RegionConstraintCollector<'tcx> { pub(in infer) var_origins: Vec, /// Constraints of the form `A <= B` introduced by the region @@ -242,9 +242,9 @@ impl TaintDirections { } } -impl<'tcx> RegionVarBindings<'tcx> { - pub fn new() -> RegionVarBindings<'tcx> { - RegionVarBindings { +impl<'tcx> RegionConstraintCollector<'tcx> { + pub fn new() -> RegionConstraintCollector<'tcx> { + RegionConstraintCollector { var_origins: Vec::new(), constraints: BTreeMap::new(), verifys: Vec::new(), @@ -264,7 +264,7 @@ impl<'tcx> RegionVarBindings<'tcx> { pub fn start_snapshot(&mut self) -> RegionSnapshot { let length = self.undo_log.len(); - debug!("RegionVarBindings: start_snapshot({})", length); + debug!("RegionConstraintCollector: start_snapshot({})", length); self.undo_log.push(OpenSnapshot); RegionSnapshot { length, @@ -274,7 +274,7 @@ impl<'tcx> RegionVarBindings<'tcx> { } pub fn commit(&mut self, snapshot: RegionSnapshot) { - debug!("RegionVarBindings: commit({})", snapshot.length); + debug!("RegionConstraintCollector: commit({})", snapshot.length); assert!(self.undo_log.len() > snapshot.length); assert!(self.undo_log[snapshot.length] == OpenSnapshot); assert!( @@ -294,7 +294,7 @@ impl<'tcx> RegionVarBindings<'tcx> { } pub fn rollback_to(&mut self, snapshot: RegionSnapshot) { - debug!("RegionVarBindings: rollback_to({:?})", snapshot); + debug!("RegionConstraintCollector: rollback_to({:?})", snapshot); assert!(self.undo_log.len() > snapshot.length); assert!(self.undo_log[snapshot.length] == OpenSnapshot); while self.undo_log.len() > snapshot.length + 1 { @@ -523,7 +523,7 @@ impl<'tcx> RegionVarBindings<'tcx> { fn add_constraint(&mut self, constraint: Constraint<'tcx>, origin: SubregionOrigin<'tcx>) { // cannot add constraints once regions are resolved - debug!("RegionVarBindings: add_constraint({:?})", constraint); + debug!("RegionConstraintCollector: add_constraint({:?})", constraint); // never overwrite an existing (constraint, origin) - only insert one if it isn't // present in the map yet. This prevents origins from outside the snapshot being @@ -542,7 +542,7 @@ impl<'tcx> RegionVarBindings<'tcx> { fn add_verify(&mut self, verify: Verify<'tcx>) { // cannot add verifys once regions are resolved - debug!("RegionVarBindings: add_verify({:?})", verify); + debug!("RegionConstraintCollector: add_verify({:?})", verify); // skip no-op cases known to be satisfied match verify.bound { @@ -594,7 +594,7 @@ impl<'tcx> RegionVarBindings<'tcx> { ) { // cannot add constraints once regions are resolved debug!( - "RegionVarBindings: make_subregion({:?}, {:?}) due to {:?}", + "RegionConstraintCollector: make_subregion({:?}, {:?}) due to {:?}", sub, sup, origin @@ -651,7 +651,7 @@ impl<'tcx> RegionVarBindings<'tcx> { b: Region<'tcx>, ) -> Region<'tcx> { // cannot add constraints once regions are resolved - debug!("RegionVarBindings: lub_regions({:?}, {:?})", a, b); + debug!("RegionConstraintCollector: lub_regions({:?}, {:?})", a, b); match (a, b) { (r @ &ReStatic, _) | (_, r @ &ReStatic) => { r // nothing lives longer than static @@ -673,7 +673,7 @@ impl<'tcx> RegionVarBindings<'tcx> { b: Region<'tcx>, ) -> Region<'tcx> { // cannot add constraints once regions are resolved - debug!("RegionVarBindings: glb_regions({:?}, {:?})", a, b); + debug!("RegionConstraintCollector: glb_regions({:?}, {:?})", a, b); match (a, b) { (&ReStatic, r) | (r, &ReStatic) => { r // static lives longer than everything else