Skip to content

Commit 267370e

Browse files
committed
Use eq_relations
1 parent fa18c12 commit 267370e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/librustc/infer/fudge.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
6262
let value = self.resolve_type_vars_if_possible(&value);
6363

6464
// At this point, `value` could in principle refer
65-
// to types/regions that have been created during
65+
// to inference variables that have been created during
6666
// the snapshot. Once we exit `probe()`, those are
6767
// going to be popped, so we will have to
6868
// eliminate any references to them.
@@ -106,10 +106,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
106106
fudger.int_vars.is_empty() &&
107107
fudger.float_vars.is_empty() &&
108108
fudger.region_vars.is_empty() {
109-
return Ok(value);
109+
Ok(value)
110+
} else {
111+
Ok(value.fold_with(&mut fudger))
110112
}
111-
112-
Ok(value.fold_with(&mut fudger))
113113
}
114114
}
115115

@@ -137,7 +137,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx>
137137
self.infcx.next_ty_var(origin)
138138
} else {
139139
// This variable was created before the
140-
// "fudging". Since we refresh all type
140+
// "fudging". Since we refresh all type
141141
// variables to their binding anyhow, we know
142142
// that it is unbound, so we can just return
143143
// it.

src/librustc/infer/type_variable.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::ops::Range;
88
use std::u32;
99
use rustc_data_structures::snapshot_vec as sv;
1010
use rustc_data_structures::unify as ut;
11-
use ut::UnifyKey;
1211

1312
pub struct TypeVariableTable<'tcx> {
1413
values: sv::SnapshotVec<Delegate>,
@@ -291,11 +290,10 @@ impl<'tcx> TypeVariableTable<'tcx> {
291290
self.sub_relations.commit(sub_snapshot);
292291
}
293292

294-
/// Returns a map from the type variables created during the
295-
/// snapshot to the origin of the type variable.
293+
/// Returns a range of the type variables created during the snapshot.
296294
pub fn vars_since_snapshot(&mut self, s: &Snapshot<'tcx>) -> Range<TyVid> {
297-
let range = self.values.values_since_snapshot(&s.snapshot);
298-
TyVid::from_index(range.start as u32)..TyVid::from_index(range.end as u32)
295+
let range = self.eq_relations.vars_since_snapshot(&s.eq_snapshot);
296+
range.start.vid..range.end.vid
299297
}
300298

301299
/// Finds the set of type variables that existed *before* `s`

0 commit comments

Comments
 (0)