apply query response: actually define opaque types

This commit is contained in:
lcnr 2023-02-22 13:28:01 +01:00
parent f9216b7564
commit cff59f80e4

View File

@ -393,6 +393,7 @@ fn query_response_substitution<R>(
/// will instantiate fresh inference variables for each canonical /// will instantiate fresh inference variables for each canonical
/// variable instead. Therefore, the result of this method must be /// variable instead. Therefore, the result of this method must be
/// properly unified /// properly unified
#[instrument(level = "debug", skip(self, cause, param_env))]
fn query_response_substitution_guess<R>( fn query_response_substitution_guess<R>(
&self, &self,
cause: &ObligationCause<'tcx>, cause: &ObligationCause<'tcx>,
@ -403,11 +404,6 @@ fn query_response_substitution_guess<R>(
where where
R: Debug + TypeFoldable<'tcx>, 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 // For each new universe created in the query result that did
// not appear in the original query, create a local // not appear in the original query, create a local
// superuniverse. // superuniverse.
@ -502,7 +498,9 @@ fn query_response_substitution_guess<R>(
for &(a, b) in &query_response.value.opaque_types { for &(a, b) in &query_response.value.opaque_types {
let a = substitute_value(self.tcx, &result_subst, a); let a = substitute_value(self.tcx, &result_subst, a);
let b = substitute_value(self.tcx, &result_subst, b); 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 }) Ok(InferOk { value: result_subst, obligations })