always make define_opaque_types
explicit
This commit is contained in:
parent
e84e5ff04a
commit
d2b7604db9
33 changed files with 308 additions and 225 deletions
|
@ -28,6 +28,7 @@ use rustc_hir::def::DefKind;
|
|||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_infer::infer::at::At;
|
||||
use rustc_infer::infer::resolve::OpportunisticRegionResolver;
|
||||
use rustc_infer::infer::DefineOpaqueTypes;
|
||||
use rustc_infer::traits::ImplSourceBuiltinData;
|
||||
use rustc_middle::traits::select::OverflowError;
|
||||
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||
|
@ -285,12 +286,12 @@ fn project_and_unify_type<'cx, 'tcx>(
|
|||
);
|
||||
obligations.extend(new);
|
||||
|
||||
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)
|
||||
{
|
||||
// Need to define opaque types to support nested opaque types like `impl Fn() -> impl Trait`
|
||||
match infcx.at(&obligation.cause, obligation.param_env).eq(
|
||||
DefineOpaqueTypes::Yes,
|
||||
normalized,
|
||||
actual,
|
||||
) {
|
||||
Ok(InferOk { obligations: inferred_obligations, value: () }) => {
|
||||
obligations.extend(inferred_obligations);
|
||||
ProjectAndUnifyResult::Holds(obligations)
|
||||
|
@ -2064,7 +2065,11 @@ fn confirm_param_env_candidate<'cx, 'tcx>(
|
|||
|
||||
debug!(?cache_projection, ?obligation_projection);
|
||||
|
||||
match infcx.at(cause, param_env).eq(cache_projection, obligation_projection) {
|
||||
match infcx.at(cause, param_env).eq(
|
||||
DefineOpaqueTypes::No,
|
||||
cache_projection,
|
||||
obligation_projection,
|
||||
) {
|
||||
Ok(InferOk { value: _, obligations }) => {
|
||||
nested_obligations.extend(obligations);
|
||||
assoc_ty_own_obligations(selcx, obligation, &mut nested_obligations);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue