Revert "Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk"

This reverts commit c703d11dcc, reversing
changes made to 64eb9ab869.
This commit is contained in:
Oli Scherer 2022-07-28 15:22:02 +00:00
parent 05e678ccca
commit a85eb3d9df
12 changed files with 69 additions and 67 deletions

View file

@ -252,10 +252,20 @@ fn project_and_unify_type<'cx, 'tcx>(
Err(InProgress) => return ProjectAndUnifyResult::Recursive,
};
debug!(?normalized, ?obligations, "project_and_unify_type result");
match infcx
.at(&obligation.cause, obligation.param_env)
.eq(normalized, obligation.predicate.term)
{
let actual = obligation.predicate.term;
// For an example where this is neccessary see src/test/ui/impl-trait/nested-return-type2.rs
// This allows users to omit re-mentioning all bounds on an associated type and just use an
// `impl Trait` for the assoc type to add more bounds.
let InferOk { value: actual, obligations: new } =
selcx.infcx().replace_opaque_types_with_inference_vars(
actual,
obligation.cause.body_id,
obligation.cause.span,
obligation.param_env,
);
obligations.extend(new);
match infcx.at(&obligation.cause, obligation.param_env).eq(normalized, actual) {
Ok(InferOk { obligations: inferred_obligations, value: () }) => {
obligations.extend(inferred_obligations);
ProjectAndUnifyResult::Holds(obligations)