提交 885f7ee1 编写于 作者: N Niko Matsakis

Extract skolemize_regions() helper function.

上级 ff35eeb8
......@@ -74,17 +74,7 @@ fn higher_ranked_sub<T>(&self, a: &T, b: &T) -> cres<'tcx, T>
// Second, we instantiate each bound region in the supertype with a
// fresh concrete region.
let (b_prime, skol_map) = {
replace_late_bound_regions(self.tcx(), b, |br, _| {
let skol =
self.infcx().region_vars.new_skolemized(
br, &snapshot.region_vars_snapshot);
debug!("Bound region {} skolemized to {}",
bound_region_to_string(self.tcx(), "", false, br),
skol);
skol
})
};
let (b_prime, skol_map) = skolemize_regions(self.infcx(), b, snapshot);
debug!("a_prime={}", a_prime.repr(self.tcx()));
debug!("b_prime={}", b_prime.repr(self.tcx()));
......@@ -538,3 +528,23 @@ fn region_vars_confined_to_snapshot(&self,
region_vars
}
}
fn skolemize_regions<'a,'tcx,HR>(infcx: &InferCtxt<'a,'tcx>,
value: &HR,
snapshot: &CombinedSnapshot)
-> (HR, FnvHashMap<ty::BoundRegion,ty::Region>)
where HR : HigherRankedFoldable<'tcx>
{
replace_late_bound_regions(infcx.tcx, value, |br, _| {
let skol =
infcx.region_vars.new_skolemized(
br,
&snapshot.region_vars_snapshot);
debug!("Bound region {} skolemized to {}",
bound_region_to_string(infcx.tcx, "", false, br),
skol);
skol
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册