-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Revert #126024 "Do not use global caches if opaque types can be defined" #132075
Conversation
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #132349) made this pull request unmergeable. Please resolve the merge conflicts. |
@rustbot author |
the compile time impact is too great for a theoretical issue. This basically reverts commit 61b5e11
This avoids the ICE in `tests/ui/type-alias-impl-trait/reveal_local.rs`.
Hi @compiler-errors, I can get this into a reviewable state (and just pushed), but I'm not sure I can get it into a landable state per se: this is getting too subtle for my puny brain. As mentioned in my last comment, some of #122192 depends on #126024, and I've also reverted part of it so that tests pass. This seems somewhat ok as it was just an I've tried to add comments, but we'd likely need actual an issue to track the possible unsoundness / not using the global cache when defining opaque types, even if it would end up being fixed only when the new solver stabilizes. So that's why it's still in draft. At this point, I'm not sure if I'm just wasting your time and it'd have been faster if you/lcnr had done the revert instead. @rustbot ready |
Oof, sorry I have not been following closely enough to understand the problem with the revert. I'll take a closer look -- thanks for pushing what you have. |
…, r=<try> Only disable cache if predicate has opaques within it This is an alternative to rust-lang#132075. It doesn't totally fix the issue, for example: `lemmy` goes from 1:29 (on rust 1.81) to 9:53 (on nightly) to 4:07 (after this PR). But I think it's at least *more* sound than a total revert :/ vibes??? r? lcnr
…, r=lcnr Only disable cache if predicate has opaques within it This is an alternative to rust-lang#132075. This refines the check implemented in rust-lang#126024 to only disable the global cache if the predicate being considered has opaques in it. This is still theoretically unsound, since goals can indirectly rely on opaques in the defining scope, but we're much less likely to hit it. It doesn't totally fix rust-lang#132064: for example, `lemmy` goes from 1:29 (on rust 1.81) to 9:53 (on nightly) to 4:07 (after this PR). But I think it's at least *more* sound than a total revert :/ r? lcnr
☔ The latest upstream changes (presumably #132625) made this pull request unmergeable. Please resolve the merge conflicts. |
@lcnr @compiler-errors do you want me to close this PR? |
yeah, I'd think so 👍 thanks for tracking this work and making sure we actually do something here |
Only disable cache if predicate has opaques within it This is an alternative to rust-lang/rust#132075. This refines the check implemented in rust-lang/rust#126024 to only disable the global cache if the predicate being considered has opaques in it. This is still theoretically unsound, since goals can indirectly rely on opaques in the defining scope, but we're much less likely to hit it. It doesn't totally fix rust-lang/rust#132064: for example, `lemmy` goes from 1:29 (on rust 1.81) to 9:53 (on nightly) to 4:07 (after this PR). But I think it's at least *more* sound than a total revert :/ r? lcnr
This PR prepares a revert of #126024 as discussed on zulip, because of its regressions to compilation times vs unclear soundness fix. Opening as draft for discussion between @compiler-errors and @lcnr.
#126024 didn't fix the ICE in #119272 (proof). Enabling the new solver in coherence did fix both the codegen ICE and incorrectly accepting the code in the first place.
It seems the theoretical unsoundness fixed in #126024 didn't yet have an MCVE showcasing the issue, and didn't have tests. The correct fix is in principle to use the new solver.
However, that is not happening soon and until then #126024 has a big impact on compile-times in some cases:
starnix_core
crate with Do not use global caches if opaque types can be defined #126024.hyper
). Some of the PR's effects should be seen by a large number of people but thankfully they're not always as dramatic as the previous 2 cases.I didn't add the crash test for #119272 back, and the
auto-traits/opaque_type_candidate_selection.rs
test was deleted in #130654. I assume the latter was because there already was coverage for such a case, but if not I can add that test back, updated for-Znext-solver=coherence
. I don't have an MCVE for #132064 but if needed, I could try to minimize it.Fixes #132064.