about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-09-07 10:00:01 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-10-04 11:02:40 -0400
commitf8dd084ef16e81e79a001f0eaa57b2cfcf835c70 (patch)
treeae53323ecdfb004fca0a05c9850c18dbd7566fa5
parent4cd4eae43592e543dbd2423102d3f286e9905623 (diff)
downloadrust-f8dd084ef16e81e79a001f0eaa57b2cfcf835c70.tar.gz
rust-f8dd084ef16e81e79a001f0eaa57b2cfcf835c70.zip
reorder the placeholders and inference variables in hr::sub
-rw-r--r--src/librustc/infer/higher_ranked/mod.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs
index e05b88feb34..da5adab586f 100644
--- a/src/librustc/infer/higher_ranked/mod.rs
+++ b/src/librustc/infer/higher_ranked/mod.rs
@@ -51,19 +51,21 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
         return self.infcx.commit_if_ok(|snapshot| {
             let span = self.trace.cause.span;
 
-            // First, we instantiate each bound region in the subtype with a fresh
-            // region variable.
+            // First, we instantiate each bound region in the supertype with a
+            // fresh placeholder region.
+            let (b_prime, placeholder_map) =
+                self.infcx.replace_late_bound_regions_with_placeholders(b);
+
+            // Next, we instantiate each bound region in the subtype
+            // with a fresh region variable. These region variables --
+            // but no other pre-existing region variables -- can name
+            // the placeholders.
             let (a_prime, _) =
                 self.infcx.replace_late_bound_regions_with_fresh_var(
                     span,
                     HigherRankedType,
                     a);
 
-            // Second, we instantiate each bound region in the supertype with a
-            // fresh concrete region.
-            let (b_prime, placeholder_map) =
-                self.infcx.replace_late_bound_regions_with_placeholders(b);
-
             debug!("a_prime={:?}", a_prime);
             debug!("b_prime={:?}", b_prime);