Make hidden type registration opt-in, so that each site can be reviewed on its own and we have the right defaults for trait solvers

This commit is contained in:
Oli Scherer 2023-02-10 16:42:53 +00:00
parent bda32a4023
commit 88a7b6803b
15 changed files with 51 additions and 26 deletions

View file

@ -286,7 +286,12 @@ fn project_and_unify_type<'cx, 'tcx>(
);
obligations.extend(new);
match infcx.at(&obligation.cause, obligation.param_env).eq(normalized, actual) {
match infcx
.at(&obligation.cause, obligation.param_env)
// This is needed to support nested opaque types like `impl Fn() -> impl Trait`
.define_opaque_types(true)
.eq(normalized, actual)
{
Ok(InferOk { obligations: inferred_obligations, value: () }) => {
obligations.extend(inferred_obligations);
ProjectAndUnifyResult::Holds(obligations)