Skip to content

Normalize all opaque types when converting ParamEnv to Reveal::All#65989

Merged
bors merged 4 commits intorust-lang:masterfrom
Aaron1011:fix/normalize-param-env
Jul 31, 2020
Merged

Normalize all opaque types when converting ParamEnv to Reveal::All#65989
bors merged 4 commits intorust-lang:masterfrom
Aaron1011:fix/normalize-param-env

Conversation

@Aaron1011
Copy link
Copy Markdown
Contributor

When we normalize a type using a ParamEnv with a reveal mode of
RevealMode::All, we will normalize opaque types to their underlying
types (e.g. type MyOpaque = impl Foo -> StructThatImplsFoo).
However, the ParamEnv may still have predicates referring to the
un-normalized opaque type (e.g. <T as MyTrait<MyOpaque>>). This can
cause trait projection to fail, since a type containing normalized
opaque types will not match up with the un-normalized type in the
ParamEnv.

To fix this, we now explicitly normalize all opaque types in
caller_bounds of a ParamEnv when changing its mode to
RevealMode::All. This ensures that all predicatse will refer to the
underlying types of any opaque types involved, allowing them to be
matched up properly during projection. To reflect the fact that
normalization is occuring, ParamEnv::with_reveal_all is renamed to
ParamEnv::with_reveal_all_normalized

Fixes #65918

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Development

Successfully merging this pull request may close these issues.

ICE with impl Fn alias.