]> git.lizzy.rs Git - rust.git/commit - src/librustc_llvm/build.rs
Auto merge of #65989 - Aaron1011:fix/normalize-param-env, r=nikomatsakis
authorbors <bors@rust-lang.org>
Fri, 31 Jul 2020 18:14:59 +0000 (18:14 +0000)
committerbors <bors@rust-lang.org>
Fri, 31 Jul 2020 18:14:59 +0000 (18:14 +0000)
commit6e87bacd37539b7e7cd75152dffd225047fa983a
tree71d61b8eeeab18886ae7008bcc2a4099fe6a886f
parent62f9aa94c0d0312544589bed78679d85646d4e62
parent5e2e927e0107916b825b164c82be44877ac6ab54
Auto merge of #65989 - Aaron1011:fix/normalize-param-env, r=nikomatsakis

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

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
src/librustc_middle/mir/interpret/value.rs
src/librustc_middle/ty/layout.rs
src/librustc_middle/ty/mod.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir_build/hair/pattern/mod.rs
src/librustc_symbol_mangling/v0.rs
src/librustc_ty/ty.rs