Skip to content

Commit 885f7ee

Browse files
committed
Extract skolemize_regions() helper function.
1 parent ff35eeb commit 885f7ee

File tree

1 file changed

+21
-11
lines changed
  • src/librustc/middle/infer/higher_ranked

1 file changed

+21
-11
lines changed

src/librustc/middle/infer/higher_ranked/mod.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,7 @@ impl<'tcx,C> HigherRankedRelations<'tcx> for C
7474

7575
// Second, we instantiate each bound region in the supertype with a
7676
// fresh concrete region.
77-
let (b_prime, skol_map) = {
78-
replace_late_bound_regions(self.tcx(), b, |br, _| {
79-
let skol =
80-
self.infcx().region_vars.new_skolemized(
81-
br, &snapshot.region_vars_snapshot);
82-
debug!("Bound region {} skolemized to {}",
83-
bound_region_to_string(self.tcx(), "", false, br),
84-
skol);
85-
skol
86-
})
87-
};
77+
let (b_prime, skol_map) = skolemize_regions(self.infcx(), b, snapshot);
8878

8979
debug!("a_prime={}", a_prime.repr(self.tcx()));
9080
debug!("b_prime={}", b_prime.repr(self.tcx()));
@@ -538,3 +528,23 @@ impl<'a,'tcx> InferCtxtExt<'tcx> for InferCtxt<'a,'tcx> {
538528
region_vars
539529
}
540530
}
531+
532+
fn skolemize_regions<'a,'tcx,HR>(infcx: &InferCtxt<'a,'tcx>,
533+
value: &HR,
534+
snapshot: &CombinedSnapshot)
535+
-> (HR, FnvHashMap<ty::BoundRegion,ty::Region>)
536+
where HR : HigherRankedFoldable<'tcx>
537+
{
538+
replace_late_bound_regions(infcx.tcx, value, |br, _| {
539+
let skol =
540+
infcx.region_vars.new_skolemized(
541+
br,
542+
&snapshot.region_vars_snapshot);
543+
544+
debug!("Bound region {} skolemized to {}",
545+
bound_region_to_string(infcx.tcx, "", false, br),
546+
skol);
547+
548+
skol
549+
})
550+
}

0 commit comments

Comments
 (0)