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 @@ pub fn higher_ranked_sub(&mut self, a: &Binder, b: &Binder, a_is_expect 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);