Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ucanonicalization bugs #496

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions chalk-solve/src/infer/ucanonicalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ impl<I: Interner> InferenceTable<I> {
DebruijnIndex::INNERMOST,
);

for universe in value0.binders.iter(interner) {
universes.add(*universe.skip_kind())
}

// Now re-map the universes found in value. We have to do this
// in a second pass because it is only then that we know the
// full set of universes found in the original value.
Expand Down Expand Up @@ -293,6 +297,20 @@ where
.to_lifetime(self.interner()))
}

fn fold_free_placeholder_const(
&mut self,
ty: &Ty<I>,
universe0: PlaceholderIndex,
_outer_binder: DebruijnIndex,
) -> Fallible<Const<I>> {
let universe = self.universes.map_universe_to_canonical(universe0.ui);
Ok(PlaceholderIndex {
ui: universe,
idx: universe0.idx,
}
.to_const(self.interner(), ty.clone()))
}

fn interner(&self) -> &'i I {
self.interner
}
Expand Down Expand Up @@ -341,6 +359,20 @@ where
.to_lifetime(self.interner()))
}

fn fold_free_placeholder_const(
&mut self,
ty: &Ty<I>,
universe0: PlaceholderIndex,
_outer_binder: DebruijnIndex,
) -> Fallible<Const<I>> {
let universe = self.universes.map_universe_from_canonical(universe0.ui);
Ok(PlaceholderIndex {
ui: universe,
idx: universe0.idx,
}
.to_const(self.interner(), ty.clone()))
}

fn forbid_inference_vars(&self) -> bool {
true
}
Expand Down