Skip to content

Commit 771231b

Browse files
Rollup merge of rust-lang#158257 - lcnr:normalize-hr-aliases, r=adwinwhite
fix escaping placeholder check in next solver normalization folder r? @BoxyUwU @adwinwhite
2 parents e8a075d + 3da4612 commit 771231b

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

compiler/rustc_next_trait_solver/src/normalize.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,24 +121,21 @@ where
121121
alias_term: AliasTerm<I>,
122122
has_escaping: HasEscapingBoundVars,
123123
) -> Result<Option<I::Term>, NoSolution> {
124-
let current_universe = self.infcx.universe();
125-
self.infcx.create_next_universe();
126-
127124
let (normalized, ambig_goal) = (self.normalize)(alias_term)?;
128125

129126
// Return ambiguous higher ranked alias as is, if
130127
// - it contains escaping vars, and
131-
// - the normalized term contains infer vars newly created
132-
// in the normalization above.
133-
// The problem is that they may be resolved to types
134-
// referencing the temporary placeholders.
128+
// - the normalized term contains infer vars which may mention
129+
// temporary placeholders after we've already mapped them back
130+
// to bound vars.
135131
//
136-
// We can normalize the ambiguous alias again after the binder is instantiated.
132+
// We can normalize the ambiguous alias again after the binder is instantiated
133+
// or once we've made further inference progress.
137134
if ambig_goal.is_some() && has_escaping == HasEscapingBoundVars::Yes {
138135
let mut visitor = MaxUniverse::new(self.infcx);
139136
normalized.visit_with(&mut visitor);
140137
let max_universe = visitor.max_universe();
141-
if current_universe.cannot_name(max_universe) {
138+
if max_universe.can_name(self.universes.first().unwrap().unwrap()) {
142139
return Ok(None);
143140
}
144141
}

0 commit comments

Comments
 (0)