rename RegionVarBindings to RegionConstraintCollector
This commit is contained in:
parent
48d8f7210b
commit
326ec52eac
4 changed files with 22 additions and 22 deletions
|
@ -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);
|
||||
|
|
|
@ -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<RegionResolutionError<'tcx>>,
|
||||
) {
|
||||
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,
|
||||
|
|
|
@ -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<UnificationTable<ty::FloatVid>>,
|
||||
|
||||
// For region variables.
|
||||
region_constraints: RefCell<RegionVarBindings<'tcx>>,
|
||||
region_constraints: RefCell<RegionConstraintCollector<'tcx>>,
|
||||
|
||||
// Once region inference is done, the values for each variable.
|
||||
lexical_region_resolutions: RefCell<Option<LexicalRegionResolutions<'tcx>>>,
|
||||
|
@ -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(),
|
||||
|
|
|
@ -143,7 +143,7 @@ enum CombineMapType {
|
|||
|
||||
type CombineMap<'tcx> = FxHashMap<TwoRegions<'tcx>, RegionVid>;
|
||||
|
||||
pub struct RegionVarBindings<'tcx> {
|
||||
pub struct RegionConstraintCollector<'tcx> {
|
||||
pub(in infer) var_origins: Vec<RegionVariableOrigin>,
|
||||
|
||||
/// 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue