Skip to content

Commit 8c52c9e

Browse files
committed
infer: rename region_vars field to region_constraints
1 parent f5fbef3 commit 8c52c9e

File tree

8 files changed

+38
-31
lines changed

8 files changed

+38
-31
lines changed

src/librustc/infer/equate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
104104
a,
105105
b);
106106
let origin = Subtype(self.fields.trace.clone());
107-
self.fields.infcx.region_vars.borrow_mut().make_eqregion(origin, a, b);
107+
self.fields.infcx.region_constraints.borrow_mut().make_eqregion(origin, a, b);
108108
Ok(a)
109109
}
110110

src/librustc/infer/fudge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
7878
self.type_variables.borrow_mut().types_created_since_snapshot(
7979
&snapshot.type_snapshot);
8080
let region_vars =
81-
self.region_vars.borrow().vars_created_since_snapshot(
82-
&snapshot.region_vars_snapshot);
81+
self.region_constraints.borrow().vars_created_since_snapshot(
82+
&snapshot.region_constraints_snapshot);
8383

8484
Ok((type_variables, region_vars, value))
8585
}

src/librustc/infer/glb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
6767
b);
6868

6969
let origin = Subtype(self.fields.trace.clone());
70-
Ok(self.fields.infcx.region_vars.borrow_mut().glb_regions(self.tcx(), origin, a, b))
70+
Ok(self.fields.infcx.region_constraints.borrow_mut().glb_regions(self.tcx(), origin, a, b))
7171
}
7272

7373
fn binders<T>(&mut self, a: &ty::Binder<T>, b: &ty::Binder<T>)

src/librustc/infer/higher_ranked/mod.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
176176
.filter(|&r| r != representative)
177177
{
178178
let origin = SubregionOrigin::Subtype(self.trace.clone());
179-
self.infcx.region_vars.borrow_mut().make_eqregion(origin,
179+
self.infcx.region_constraints.borrow_mut().make_eqregion(origin,
180180
*representative,
181181
*region);
182182
}
@@ -427,7 +427,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
427427
fn fresh_bound_variable<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
428428
debruijn: ty::DebruijnIndex)
429429
-> ty::Region<'tcx> {
430-
infcx.region_vars.borrow_mut().new_bound(infcx.tcx, debruijn)
430+
infcx.region_constraints.borrow_mut().new_bound(infcx.tcx, debruijn)
431431
}
432432
}
433433
}
@@ -481,7 +481,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
481481
r: ty::Region<'tcx>,
482482
directions: TaintDirections)
483483
-> FxHashSet<ty::Region<'tcx>> {
484-
self.region_vars.borrow().tainted(self.tcx, &snapshot.region_vars_snapshot, r, directions)
484+
self.region_constraints.borrow().tainted(
485+
self.tcx,
486+
&snapshot.region_constraints_snapshot,
487+
r,
488+
directions)
485489
}
486490

487491
fn region_vars_confined_to_snapshot(&self,
@@ -539,7 +543,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
539543
*/
540544

541545
let mut region_vars =
542-
self.region_vars.borrow().vars_created_since_snapshot(&snapshot.region_vars_snapshot);
546+
self.region_constraints.borrow().vars_created_since_snapshot(
547+
&snapshot.region_constraints_snapshot);
543548

544549
let escaping_types =
545550
self.type_variables.borrow_mut().types_escaping_snapshot(&snapshot.type_snapshot);
@@ -581,9 +586,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
581586
where T : TypeFoldable<'tcx>
582587
{
583588
let (result, map) = self.tcx.replace_late_bound_regions(binder, |br| {
584-
self.region_vars.borrow_mut().push_skolemized(self.tcx,
589+
self.region_constraints.borrow_mut().push_skolemized(self.tcx,
585590
br,
586-
&snapshot.region_vars_snapshot)
591+
&snapshot.region_constraints_snapshot)
587592
});
588593

589594
debug!("skolemize_bound_regions(binder={:?}, result={:?}, map={:?})",
@@ -768,9 +773,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
768773
{
769774
debug!("pop_skolemized({:?})", skol_map);
770775
let skol_regions: FxHashSet<_> = skol_map.values().cloned().collect();
771-
self.region_vars.borrow_mut().pop_skolemized(self.tcx,
772-
&skol_regions,
773-
&snapshot.region_vars_snapshot);
776+
self.region_constraints.borrow_mut().pop_skolemized(
777+
self.tcx,
778+
&skol_regions,
779+
&snapshot.region_constraints_snapshot);
774780
if !skol_map.is_empty() {
775781
self.projection_cache.borrow_mut().rollback_skolemized(
776782
&snapshot.projection_cache_snapshot);

src/librustc/infer/lub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
6767
b);
6868

6969
let origin = Subtype(self.fields.trace.clone());
70-
Ok(self.fields.infcx.region_vars.borrow_mut().lub_regions(self.tcx(), origin, a, b))
70+
Ok(self.fields.infcx.region_constraints.borrow_mut().lub_regions(self.tcx(), origin, a, b))
7171
}
7272

7373
fn binders<T>(&mut self, a: &ty::Binder<T>, b: &ty::Binder<T>)

src/librustc/infer/mod.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub struct InferCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
104104
float_unification_table: RefCell<UnificationTable<ty::FloatVid>>,
105105

106106
// For region variables.
107-
region_constraints: RefCell<RegionConstraints<'tcx>>,
107+
region_constraints: RefCell<RegionVarBindings<'tcx>>,
108108

109109
// Once region inference is done, the values for each variable.
110110
lexical_region_resolutions: RefCell<Option<LexicalRegionResolutions<'tcx>>>,
@@ -424,7 +424,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> {
424424
type_variables: RefCell::new(type_variable::TypeVariableTable::new()),
425425
int_unification_table: RefCell::new(UnificationTable::new()),
426426
float_unification_table: RefCell::new(UnificationTable::new()),
427-
region_vars: RefCell::new(RegionVarBindings::new()),
427+
region_constraints: RefCell::new(RegionVarBindings::new()),
428428
lexical_region_resolutions: RefCell::new(None),
429429
selection_cache: traits::SelectionCache::new(),
430430
evaluation_cache: traits::EvaluationCache::new(),
@@ -459,7 +459,7 @@ pub struct CombinedSnapshot<'a, 'tcx:'a> {
459459
type_snapshot: type_variable::Snapshot,
460460
int_snapshot: unify::Snapshot<ty::IntVid>,
461461
float_snapshot: unify::Snapshot<ty::FloatVid>,
462-
region_vars_snapshot: RegionSnapshot,
462+
region_constraints_snapshot: RegionSnapshot,
463463
was_in_snapshot: bool,
464464
_in_progress_tables: Option<Ref<'a, ty::TypeckTables<'tcx>>>,
465465
}
@@ -767,7 +767,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
767767
type_snapshot: self.type_variables.borrow_mut().snapshot(),
768768
int_snapshot: self.int_unification_table.borrow_mut().snapshot(),
769769
float_snapshot: self.float_unification_table.borrow_mut().snapshot(),
770-
region_vars_snapshot: self.region_vars.borrow_mut().start_snapshot(),
770+
region_constraints_snapshot: self.region_constraints.borrow_mut().start_snapshot(),
771771
was_in_snapshot: in_snapshot,
772772
// Borrow tables "in progress" (i.e. during typeck)
773773
// to ban writes from within a snapshot to them.
@@ -783,7 +783,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
783783
type_snapshot,
784784
int_snapshot,
785785
float_snapshot,
786-
region_vars_snapshot,
786+
region_constraints_snapshot,
787787
was_in_snapshot,
788788
_in_progress_tables } = snapshot;
789789

@@ -801,9 +801,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
801801
self.float_unification_table
802802
.borrow_mut()
803803
.rollback_to(float_snapshot);
804-
self.region_vars
804+
self.region_constraints
805805
.borrow_mut()
806-
.rollback_to(region_vars_snapshot);
806+
.rollback_to(region_constraints_snapshot);
807807
}
808808

809809
fn commit_from(&self, snapshot: CombinedSnapshot) {
@@ -812,7 +812,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
812812
type_snapshot,
813813
int_snapshot,
814814
float_snapshot,
815-
region_vars_snapshot,
815+
region_constraints_snapshot,
816816
was_in_snapshot,
817817
_in_progress_tables } = snapshot;
818818

@@ -830,9 +830,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
830830
self.float_unification_table
831831
.borrow_mut()
832832
.commit(float_snapshot);
833-
self.region_vars
833+
self.region_constraints
834834
.borrow_mut()
835-
.commit(region_vars_snapshot);
835+
.commit(region_constraints_snapshot);
836836
}
837837

838838
/// Execute `f` and commit the bindings
@@ -887,7 +887,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
887887
sub: ty::Region<'tcx>,
888888
sup: ty::RegionVid)
889889
{
890-
self.region_vars.borrow_mut().add_given(sub, sup);
890+
self.region_constraints.borrow_mut().add_given(sub, sup);
891891
}
892892

893893
pub fn can_sub<T>(&self,
@@ -927,7 +927,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
927927
a: ty::Region<'tcx>,
928928
b: ty::Region<'tcx>) {
929929
debug!("sub_regions({:?} <: {:?})", a, b);
930-
self.region_vars.borrow_mut().make_subregion(origin, a, b);
930+
self.region_constraints.borrow_mut().make_subregion(origin, a, b);
931931
}
932932

933933
pub fn equality_predicate(&self,
@@ -1030,7 +1030,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10301030

10311031
pub fn next_region_var(&self, origin: RegionVariableOrigin)
10321032
-> ty::Region<'tcx> {
1033-
self.tcx.mk_region(ty::ReVar(self.region_vars.borrow_mut().new_region_var(origin)))
1033+
self.tcx.mk_region(ty::ReVar(self.region_constraints.borrow_mut().new_region_var(origin)))
10341034
}
10351035

10361036
/// Create a region inference variable for the given
@@ -1127,7 +1127,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
11271127
region_map,
11281128
free_regions);
11291129
let (lexical_region_resolutions, errors) =
1130-
self.region_vars.borrow_mut().resolve_regions(&region_rels);
1130+
self.region_constraints.borrow_mut().resolve_regions(&region_rels);
11311131

11321132
let old_value = self.lexical_region_resolutions.replace(Some(lexical_region_resolutions));
11331133
assert!(old_value.is_none());
@@ -1365,7 +1365,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
13651365
a,
13661366
bound);
13671367

1368-
self.region_vars.borrow_mut().verify_generic_bound(origin, kind, a, bound);
1368+
self.region_constraints.borrow_mut().verify_generic_bound(origin, kind, a, bound);
13691369
}
13701370

13711371
pub fn type_moves_by_default(&self,

src/librustc/infer/resolve.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolv
7575
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
7676
match *r {
7777
ty::ReVar(rid) =>
78-
self.infcx.region_vars.borrow_mut().opportunistic_resolve_var(self.tcx(), rid),
78+
self.infcx.region_constraints.borrow_mut()
79+
.opportunistic_resolve_var(self.tcx(), rid),
7980
_ =>
8081
r,
8182
}

src/librustc/infer/sub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
137137
// from the "cause" field, we could perhaps give more tailored
138138
// error messages.
139139
let origin = SubregionOrigin::Subtype(self.fields.trace.clone());
140-
self.fields.infcx.region_vars.borrow_mut().make_subregion(origin, a, b);
140+
self.fields.infcx.region_constraints.borrow_mut().make_subregion(origin, a, b);
141141

142142
Ok(a)
143143
}

0 commit comments

Comments
 (0)