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

apply query response: actually define opaque types #108342

Merged
merged 1 commit into from
Feb 23, 2023
Merged
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
10 changes: 4 additions & 6 deletions compiler/rustc_infer/src/infer/canonical/query_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ impl<'tcx> InferCtxt<'tcx> {
/// will instantiate fresh inference variables for each canonical
/// variable instead. Therefore, the result of this method must be
/// properly unified
#[instrument(level = "debug", skip(self, cause, param_env))]
fn query_response_substitution_guess<R>(
&self,
cause: &ObligationCause<'tcx>,
Expand All @@ -403,11 +404,6 @@ impl<'tcx> InferCtxt<'tcx> {
where
R: Debug + TypeFoldable<'tcx>,
{
debug!(
"query_response_substitution_guess(original_values={:#?}, query_response={:#?})",
original_values, query_response,
);

// For each new universe created in the query result that did
// not appear in the original query, create a local
// superuniverse.
Expand Down Expand Up @@ -502,7 +498,9 @@ impl<'tcx> InferCtxt<'tcx> {
for &(a, b) in &query_response.value.opaque_types {
let a = substitute_value(self.tcx, &result_subst, a);
let b = substitute_value(self.tcx, &result_subst, b);
obligations.extend(self.at(cause, param_env).eq(a, b)?.obligations);
debug!(?a, ?b, "constrain opaque type");
obligations
.extend(self.at(cause, param_env).define_opaque_types(true).eq(a, b)?.obligations);
}

Ok(InferOk { value: result_subst, obligations })
Expand Down