diff --git a/src/librustc/infer/region_inference/graphviz.rs b/src/librustc/infer/lexical_region_resolve/graphviz.rs similarity index 100% rename from src/librustc/infer/region_inference/graphviz.rs rename to src/librustc/infer/lexical_region_resolve/graphviz.rs diff --git a/src/librustc/infer/region_inference/lexical_resolve.rs b/src/librustc/infer/lexical_region_resolve/mod.rs similarity index 99% rename from src/librustc/infer/region_inference/lexical_resolve.rs rename to src/librustc/infer/lexical_region_resolve/mod.rs index f32cd45a740..8c5d7a7fc9b 100644 --- a/src/librustc/infer/region_inference/lexical_resolve.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -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>, diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index e73d74c22ba..cf32113343d 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -55,6 +55,7 @@ pub mod lattice; mod lub; pub mod region_inference; +mod lexical_region_resolve; mod outlives; pub mod resolve; mod freshen; diff --git a/src/librustc/infer/region_inference/mod.rs b/src/librustc/infer/region_inference/mod.rs index 59e9c4d3d00..e197f4f27ef 100644 --- a/src/librustc/infer/region_inference/mod.rs +++ b/src/librustc/infer/region_inference/mod.rs @@ -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, RegionVid>; pub struct RegionVarBindings<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, - var_origins: RefCell>, + pub(in infer) tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub(in infer) var_origins: RefCell>, /// 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, SubregionOrigin<'tcx>>>, + pub(in infer) constraints: RefCell, 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>>, + pub(in infer) verifys: RefCell>>, /// 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, ty::RegionVid)>>, + pub(in infer) givens: RefCell, ty::RegionVid)>>, lubs: RefCell>, glbs: RefCell>, @@ -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>>>, + pub(in infer) values: RefCell>>>, } pub struct RegionSnapshot {