move region resolution to be a sibling of region_inference

Temporary make various fields public.
This commit is contained in:
Niko Matsakis 2017-11-15 16:58:14 -05:00
parent 467f2ea653
commit 58c77600a5
4 changed files with 9 additions and 10 deletions

View File

@ -11,7 +11,6 @@
//! The code to do lexical region resolution.
use infer::SubregionOrigin;
use infer::region_inference::graphviz;
use infer::region_inference::Constraint;
use infer::region_inference::Constraint::*;
use infer::region_inference::RegionVarBindings;
@ -28,6 +27,8 @@
use ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound, ReErased};
use ty::{ReLateBound, ReScope, ReVar, ReSkolemized};
mod graphviz;
struct RegionAndOrigin<'tcx> {
region: Region<'tcx>,
origin: SubregionOrigin<'tcx>,

View File

@ -55,6 +55,7 @@
pub mod lattice;
mod lub;
pub mod region_inference;
mod lexical_region_resolve;
mod outlives;
pub mod resolve;
mod freshen;

View File

@ -32,9 +32,6 @@
use std::mem;
use std::u32;
mod lexical_resolve;
mod graphviz;
/// A constraint that influences the inference process.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)]
pub enum Constraint<'tcx> {
@ -186,8 +183,8 @@ pub enum VarValue<'tcx> {
pub type CombineMap<'tcx> = FxHashMap<TwoRegions<'tcx>, RegionVid>;
pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
tcx: TyCtxt<'a, 'gcx, 'tcx>,
var_origins: RefCell<Vec<RegionVariableOrigin>>,
pub(in infer) tcx: TyCtxt<'a, 'gcx, 'tcx>,
pub(in infer) var_origins: RefCell<Vec<RegionVariableOrigin>>,
/// Constraints of the form `A <= B` introduced by the region
/// checker. Here at least one of `A` and `B` must be a region
@ -198,14 +195,14 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
/// which in turn affects the way that region errors are reported,
/// leading to small variations in error output across runs and
/// platforms.
constraints: RefCell<BTreeMap<Constraint<'tcx>, SubregionOrigin<'tcx>>>,
pub(in infer) constraints: RefCell<BTreeMap<Constraint<'tcx>, SubregionOrigin<'tcx>>>,
/// A "verify" is something that we need to verify after inference is
/// done, but which does not directly affect inference in any way.
///
/// An example is a `A <= B` where neither `A` nor `B` are
/// inference variables.
verifys: RefCell<Vec<Verify<'tcx>>>,
pub(in infer) verifys: RefCell<Vec<Verify<'tcx>>>,
/// A "given" is a relationship that is known to hold. In particular,
/// we often know from closure fn signatures that a particular free
@ -224,7 +221,7 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
/// record the fact that `'a <= 'b` is implied by the fn signature,
/// and then ignore the constraint when solving equations. This is
/// a bit of a hack but seems to work.
givens: RefCell<FxHashSet<(Region<'tcx>, ty::RegionVid)>>,
pub(in infer) givens: RefCell<FxHashSet<(Region<'tcx>, ty::RegionVid)>>,
lubs: RefCell<CombineMap<'tcx>>,
glbs: RefCell<CombineMap<'tcx>>,
@ -246,7 +243,7 @@ pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
/// This contains the results of inference. It begins as an empty
/// option and only acquires a value after inference is complete.
values: RefCell<Option<Vec<VarValue<'tcx>>>>,
pub(in infer) values: RefCell<Option<Vec<VarValue<'tcx>>>>,
}
pub struct RegionSnapshot {