Uh oh!
There was an error while loading. Please reload this page.
Normalize all opaque types when converting ParamEnv to Reveal::All - #65989
Conversation
rust-highfive
commented
Oct 31, 2019
(rust_highfive has picked a reviewer for you, use r? to override) |
Centril
left a comment
There was a problem hiding this comment.
Just some nits. :)
Nice PR!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Aaron1011
commented
Oct 31, 2019
@Centril I've addressed your comments. |
petrochenkov
commented
Nov 1, 2019
r? @eddyb for review or reassignment |
eddyb
commented
Nov 2, 2019
This is @rust-lang/wg-traits territory. |
JohnCSimon
commented
Nov 9, 2019
Ping from triage: Thanks! |
JohnCSimon
commented
Nov 16, 2019
Pinging again from triage: Thanks! |
Dylan-DPC-zz
commented
Nov 24, 2019
petrochenkov
commented
Nov 24, 2019
I'm not qualified to review this. |
bors
commented
Dec 1, 2019
☔ The latest upstream changes (presumably #66908) made this pull request unmergeable. Please resolve the merge conflicts. |
6d6b5d5 to
33e196dComparenikomatsakis
commented
Dec 7, 2019
Will review -- sorry for radio silence |
nikomatsakis
left a comment
There was a problem hiding this comment.
Yet another example of why it would be good to pursue an alternative normalization strategy, I suppose. I am curious though whether this has any performance impact. We may want to think about more aggressive caching.
nikomatsakis
commented
Dec 7, 2019
@bors try |
bors
commented
Dec 7, 2019
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
bors
commented
Dec 7, 2019
☀️ Try build successful - checks-azure |
Aaron1011
commented
Dec 8, 2019
@nikomatsakis: Did you mean to do a |
nikomatsakis
commented
Dec 10, 2019
@Aaron1011 dang it, yes I did |
bors
commented
Jun 13, 2020
☀️ Try build successful - checks-azure |
rust-timer
commented
Jun 13, 2020
Queued cd9893430843101b421d45480d3dcb55c4dce64f with parent f4fbb93, future comparison URL. |
rust-timer
commented
Jun 13, 2020
Finished benchmarking try commit (cd9893430843101b421d45480d3dcb55c4dce64f): comparison url. |
nikomatsakis
commented
Jun 15, 2020
Well, it definitely hurts the stress tests =) |
Dylan-DPC-zz
commented
Jul 18, 2020
@Aaron1011 any updates on this? |
nikomatsakis
commented
Jul 20, 2020
@matthewjasper was working on a PR that improved the perf of the stress tests quite a bit, might be worth retesting. I'm not sure though if that PR landed yet. |
Aaron1011
commented
Jul 22, 2020
@bors try @rust-timer queue |
rust-timer
commented
Jul 22, 2020
Awaiting bors try build completion |
bors
commented
Jul 22, 2020
⌛ Trying commit 5e2e927 with merge 95dcfa37cf97c1d630a7820e31d39a7a37ae2c1d... |
bors
commented
Jul 22, 2020
☀️ Try build successful - checks-actions, checks-azure |
rust-timer
commented
Jul 22, 2020
Queued 95dcfa37cf97c1d630a7820e31d39a7a37ae2c1d with parent 4825e12, future comparison URL. |
rust-timer
commented
Jul 22, 2020
Finished benchmarking try commit (95dcfa37cf97c1d630a7820e31d39a7a37ae2c1d): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
@nikomatsakis: It looks like almost all of the perf impact is gone. |
nikomatsakis
commented
Jul 27, 2020
@bors r+ |
bors
commented
Jul 27, 2020
📌 Commit 5e2e927 has been approved by |
bors
commented
Jul 27, 2020
⌛ Testing commit 5e2e927 with merge a7b1b8ea5d0b7b7e6d162fe0066eb0f1afc94778... |
bors
commented
Jul 27, 2020
💔 Test failed - checks-actions |
Aaron1011
commented
Jul 31, 2020
I think this was a spurious failure. @bors r=nikomatsakis |
bors
commented
Jul 31, 2020
💡 This pull request was already approved, no need to approve it again.
|
bors
commented
Jul 31, 2020
📌 Commit 5e2e927 has been approved by |
bors
commented
Jul 31, 2020
bors
commented
Jul 31, 2020
☀️ Test successful - checks-actions, checks-azure |
Mark-Simulacrum
commented
Aug 3, 2020
This was a slight performance regression, as expected. |
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 cancause 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
ParamEnvwhen changing its mode toRevealMode::All. This ensures that all predicatse will refer to theunderlying 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_allis renamed toParamEnv::with_reveal_all_normalizedFixes#65918