Skip to content

Commit 9474cc5

Browse files
committed
---
yaml --- r: 164618 b: refs/heads/auto c: ed4952e h: refs/heads/master v: v3
1 parent 9100c7e commit 9474cc5

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 416e62924e200eb75dff4b7d622b5aa7ea8b691a
13+
refs/heads/auto: ed4952ef392952dc4a7d0241386daf575dea5d6e
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/infer/mod.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ pub struct InferCtxt<'a, 'tcx: 'a> {
9090
RegionVarBindings<'a, 'tcx>,
9191
}
9292

93+
/// A map returned by `skolemize_bound_regions()` indicating the skolemized
94+
/// region that each late-bound region was replaced with.
95+
pub type SkolemizationMap = FnvHashMap<ty::BoundRegion,ty::Region>;
96+
9397
/// Why did we require that the two types be related?
9498
///
9599
/// See `error_reporting.rs` for more details
@@ -698,9 +702,25 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
698702
self.sub(a_is_expected, trace).poly_trait_refs(&*a, &*b).to_ures()
699703
})
700704
}
701-
}
702705

703-
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
706+
pub fn skolemize_bound_regions<T>(&self,
707+
value: &ty::Binder<T>,
708+
snapshot: &CombinedSnapshot)
709+
-> (T, SkolemizationMap)
710+
where T : TypeFoldable<'tcx>
711+
{
712+
let (result_binder, map) = replace_late_bound_regions(self.tcx, value, |br, _| {
713+
self.region_vars.new_skolemized(br, &snapshot.region_vars_snapshot)
714+
});
715+
716+
debug!("skolemize_bound_regions(value={}, result={}, map={})",
717+
value.repr(self.tcx),
718+
result_binder.value.repr(self.tcx),
719+
map.repr(self.tcx));
720+
721+
(result_binder.value, map)
722+
}
723+
704724
pub fn next_ty_var_id(&self, diverging: bool) -> TyVid {
705725
self.type_variables
706726
.borrow_mut()

0 commit comments

Comments
 (0)