Skip to content

Commit f8dd084

Browse files
committed
reorder the placeholders and inference variables in hr::sub
1 parent 4cd4eae commit f8dd084

File tree

1 file changed

+9
-7
lines changed
  • src/librustc/infer/higher_ranked

1 file changed

+9
-7
lines changed

src/librustc/infer/higher_ranked/mod.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,21 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
5151
return self.infcx.commit_if_ok(|snapshot| {
5252
let span = self.trace.cause.span;
5353

54-
// First, we instantiate each bound region in the subtype with a fresh
55-
// region variable.
54+
// First, we instantiate each bound region in the supertype with a
55+
// fresh placeholder region.
56+
let (b_prime, placeholder_map) =
57+
self.infcx.replace_late_bound_regions_with_placeholders(b);
58+
59+
// Next, we instantiate each bound region in the subtype
60+
// with a fresh region variable. These region variables --
61+
// but no other pre-existing region variables -- can name
62+
// the placeholders.
5663
let (a_prime, _) =
5764
self.infcx.replace_late_bound_regions_with_fresh_var(
5865
span,
5966
HigherRankedType,
6067
a);
6168

62-
// Second, we instantiate each bound region in the supertype with a
63-
// fresh concrete region.
64-
let (b_prime, placeholder_map) =
65-
self.infcx.replace_late_bound_regions_with_placeholders(b);
66-
6769
debug!("a_prime={:?}", a_prime);
6870
debug!("b_prime={:?}", b_prime);
6971

0 commit comments

Comments
 (0)