Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for evaluate_obligation: Ok(EvaluatedToOkModuloRegions) ICE #91065

Merged
merged 3 commits into from
Dec 7, 2021

Conversation

wesleywiser
Copy link
Member

@wesleywiser wesleywiser commented Nov 20, 2021

Adds the minimial repro test case from #85360. The fix for #85360 was
supposed to be #85868 however the repro was resolved in the 2021-07-05
nightly while #85868 didn't land until 2021-09-03. The reason for that
is d34a3a4 also resolves that
issue.

To test if #85868 actually fixes #85360, I reverted
d34a3a4 and found that #85868 does
indeed resolve #85360.

With that question resolved, add a test case to our incremental test
suite for the original Ok(EvaluatedToOkModuloRegions) ICE.

Thanks to @lqd for helping track this down!

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 20, 2021
@jackh726
Copy link
Member

@Aaron1011 was #85868 supposed to fix something that #85090 didn't? Did you have a test case (different from the one that got minimised here) that was still failing after #85090?

@Aaron1011
Copy link
Member

@jackh726 #85090 is a pure optimization that shouldn't affect anything incremental-related.

@jackh726
Copy link
Member

According to @wesleywiser, #85090 did fix #85360 (I also see that in #85868 (comment)). I guess my thoughts are: if #85090 did completely fix the underlying incremental issue, then why did we need to land #85868? If it didn't, then the test added here isn't sufficient to ensure we don't regress. That's not to say that we shouldn't add this test - but it's unclear if there's an actual reproduction that motivated #85868, or a theoretical one.

@wesleywiser
Copy link
Member Author

wesleywiser commented Nov 20, 2021

(I also see that in #85868 (comment))

Right. @lqd and I wanted to understand why the minimized repro stopped reproducing prior to the intended fix. I ran a bisect and got these results:

searched toolchains 71b8742 through b3d11f9


Regression in d34a3a4


searched nightlies: from nightly-2021-07-04 to nightly-2021-07-06
regressed nightly: nightly-2021-07-05
searched commits: from 71b8742 to b3d11f9
regressed commit: d34a3a4


@lqd had already determined previously when trying to construct a regression test that the nightly where this stopped reproducing was 2021-07-05 which is why the search space was so small.

Edit: Note, because the change we're looking for was "ICEing -> not ICEing", "regression" in the above report actually indicates the commit which fixed the reproducer.

@Mark-Simulacrum
Copy link
Member

This seems fine to me, but I want to r? @jackh726 (or perhaps @Aaron1011) since I feel like you're better able to determine whether this is the right test.

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 22, 2021
@Aaron1011
Copy link
Member

Aaron1011 commented Nov 22, 2021

Could you add #[rustc_evaluate_where_clauses] attributes, as done in #85186 ? That should allow us to catch any future caching changes that affect the evaluation results for this test (even if there isn't an incremental ICE).

Can you also add -Z assert-incr-state=not-loaded and -Z assert-incr-state=loaded to the first and second invocations respectively? See
https://github.com/rust-lang/rust/pull/90386/files#diff-1f16ba7af24cec6d9c6f8fc179a0313ec3307a4124c9cf7756f4541723e0feb2 for an example of doing this in an incremental test.

@wesleywiser
Copy link
Member Author

Sure! I just pushed a commit that does that as a separate UI test. If there's a better way to combine the tests, feel free to let me know.

@Aaron1011
Copy link
Member

r=me unless @jackh726 wants any changes.

@jackh726
Copy link
Member

According to @wesleywiser, #85090 did fix #85360 (I also see that in #85868 (comment)). I guess my thoughts are: if #85090 did completely fix the underlying incremental issue, then why did we need to land #85868? If it didn't, then the test added here isn't sufficient to ensure we don't regress. That's not to say that we shouldn't add this test - but it's unclear if there's an actual reproduction that motivated #85868, or a theoretical one.

@Aaron1011 any thoughts here? Specifically, do you think there is a bug that isn't covered by this regression test?

Regardless, I think we should land this test. @bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 23, 2021

📌 Commit c078c5ac597dfa58c59690a4cad8397ca2df2545 has been approved by jackh726

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 23, 2021
@jackh726
Copy link
Member

@bors r=Aaron1011,jackh726

just to register the dual review

@bors
Copy link
Contributor

bors commented Nov 23, 2021

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Nov 23, 2021

📌 Commit c078c5ac597dfa58c59690a4cad8397ca2df2545 has been approved by Aaron1011,jackh726

@Aaron1011
Copy link
Member

PR 85090 causes us to always return EvaluatedToOk for certain predicates. Since the incremental bug requires that we end up with EvaluatedToOkModuloRegions in one compilation run, that PR reduces the number of cases where we could potentially hit the bug. However, it does actually fix the bug, since we will still need to return EvaluatedToOkModuloRegions for other predicates (which requires that the cache behaves correctly).

To make the test more robust, we could land a follow-up PR asserting that some where clause actually evaluates to EvaluatedToOkModuloRegions. Additionally, we can write a unit test that explicitly checks what happens when we evaluate an EvaluatedToOkModuloRegions predicate with a populated cache.

@jackh726
Copy link
Member

Okay, so sounds like this does not "close" #85360, at least in terms of a proper regression test for the evaluate_obligation ICE. At least, this doesn't completely alleviate my concerns about making further changes to the projection cache for performance only.

(Should we reopen #85360, or open a new issue to properly track the lack of a regression test to ensure that the cache behaves correctly for EvaluatedToOkModuloRegions?)

@wesleywiser
Copy link
Member Author

@bors r-

I think I should go ahead and do that as part of this PR.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 24, 2021
_t: T,
}

impl<T: 'static> Component for GenericComp<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make the top-level evaluation produce EvaluatedToOkModuloRegions by adding where for<'a> &'a bool: 'a to this impl. However, this will not work until #91329 is merged

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that that PR has been merged, it should be possible to adjust this impl to produce EvaluatedToOkModuloRegions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented. Thanks @Aaron1011!

Adds the minimial repro test case from rust-lang#85360. The fix for rust-lang#85360 was
supposed to be rust-lang#85868 however the repro was resolved in the 2021-07-05
nightly while rust-lang#85360 didn't land until 2021-09-03. The reason for that
is d34a3a4 **also** resolves that
issue.

To test if rust-lang#85868 actually fixes rust-lang#85360, I reverted
d34a3a4 and found that rust-lang#85868 does
indeed resolve rust-lang#85360.

With that question resolved, add a test case to our incremental test
suite for the original Ok(EvaluatedToOkModuloRegions) ICE.

Thanks to @lqd for helping track this down!
As suggested via reviewer feedback.
@jackh726
Copy link
Member

jackh726 commented Dec 4, 2021

Does the current test fail after reverting #85868 but not #85090?

@wesleywiser
Copy link
Member Author

Yes, that's correct.

@jackh726
Copy link
Member

jackh726 commented Dec 6, 2021

Amazing. Thank you both @wesleywiser @Aaron1011

@bors r+

@bors
Copy link
Contributor

bors commented Dec 6, 2021

📌 Commit 6fe13f6 has been approved by jackh726

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 6, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 6, 2021
Add test for evaluate_obligation: Ok(EvaluatedToOkModuloRegions) ICE

Adds the minimial repro test case from rust-lang#85360. The fix for rust-lang#85360 was
supposed to be rust-lang#85868 however the repro was resolved in the 2021-07-05
nightly while rust-lang#85868 didn't land until 2021-09-03. The reason for that
is d34a3a4 **also** resolves that
issue.

To test if rust-lang#85868 actually fixes rust-lang#85360, I reverted
d34a3a4 and found that rust-lang#85868 does
indeed resolve rust-lang#85360.

With that question resolved, add a test case to our incremental test
suite for the original Ok(EvaluatedToOkModuloRegions) ICE.

Thanks to `@lqd` for helping track this down!
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 6, 2021
Add test for evaluate_obligation: Ok(EvaluatedToOkModuloRegions) ICE

Adds the minimial repro test case from rust-lang#85360. The fix for rust-lang#85360 was
supposed to be rust-lang#85868 however the repro was resolved in the 2021-07-05
nightly while rust-lang#85868 didn't land until 2021-09-03. The reason for that
is d34a3a4 **also** resolves that
issue.

To test if rust-lang#85868 actually fixes rust-lang#85360, I reverted
d34a3a4 and found that rust-lang#85868 does
indeed resolve rust-lang#85360.

With that question resolved, add a test case to our incremental test
suite for the original Ok(EvaluatedToOkModuloRegions) ICE.

Thanks to ``@lqd`` for helping track this down!
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 7, 2021
Add test for evaluate_obligation: Ok(EvaluatedToOkModuloRegions) ICE

Adds the minimial repro test case from rust-lang#85360. The fix for rust-lang#85360 was
supposed to be rust-lang#85868 however the repro was resolved in the 2021-07-05
nightly while rust-lang#85868 didn't land until 2021-09-03. The reason for that
is d34a3a4 **also** resolves that
issue.

To test if rust-lang#85868 actually fixes rust-lang#85360, I reverted
d34a3a4 and found that rust-lang#85868 does
indeed resolve rust-lang#85360.

With that question resolved, add a test case to our incremental test
suite for the original Ok(EvaluatedToOkModuloRegions) ICE.

Thanks to ```@lqd``` for helping track this down!
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 7, 2021
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#87614 (Recommend fix `count()` -> `len()` on slices)
 - rust-lang#91065 (Add test for evaluate_obligation: Ok(EvaluatedToOkModuloRegions) ICE)
 - rust-lang#91312 (Fix AnonConst ICE)
 - rust-lang#91341 (Add `array::IntoIter::{empty, from_raw_parts}`)
 - rust-lang#91493 (Remove a dead code path.)
 - rust-lang#91503 (Tweak "call this function" suggestion to have smaller span)
 - rust-lang#91547 (Suggest try_reserve in try_reserve_exact)
 - rust-lang#91562 (Pretty print async block without redundant space)
 - rust-lang#91620 (Update books)
 - rust-lang#91622 (:arrow_up: rust-analyzer)

Failed merges:

 - rust-lang#91571 (Remove unneeded access to pretty printer's `s` field in favor of deref)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 42d0f83 into rust-lang:master Dec 7, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 7, 2021
@pnkfelix pnkfelix added beta-accepted Accepted for backporting to the compiler in the beta channel. beta-nominated Nominated for backporting to the compiler in the beta channel. labels Dec 16, 2021
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 5, 2022
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.59.0, 1.58.0 Jan 5, 2022
@Mark-Simulacrum Mark-Simulacrum removed the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jan 5, 2022
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.58.0, 1.59.0 Jan 5, 2022
@Mark-Simulacrum
Copy link
Member

Declining beta-backport: the test added by this PR does not pass when backported alongside #90423, and we believe that this is due to other PRs not being backported (which we don't want to backport at this time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incremental compilation error with evaluate_obligation: Ok(EvaluatedToOkModuloRegions)
9 participants