-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Pass list of defineable opaque types into canonical queries #122077
Conversation
6946681
to
119a935
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Pass list of defineable opaque types into canonical queries based on rust-lang#121796 This eliminates `DefiningAnchor::Bubble` for good and brings the old solver closer to the new one wrt cycles and nested obligations. r? `@ghost`
@@ -320,5 +320,6 @@ fn response_no_constraints_raw<'tcx>( | |||
external_constraints: tcx.mk_external_constraints(ExternalConstraintsData::default()), | |||
certainty, | |||
}, | |||
defining_anchor: Default::default(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is fishy, we can probably always pass in the anchor from the InferCtxt
let (infcx, key, canonical_inference_vars) = self | ||
.with_opaque_type_inference(DefiningAnchor::Bubble) | ||
.build_with_canonical(DUMMY_SP, canonical_key); | ||
let (infcx, key, canonical_inference_vars) = | ||
self.build_with_canonical(DUMMY_SP, canonical_key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the core change of this PR. Canonical queries now always use the anchor of their caller
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
@@ -340,10 +340,10 @@ macro_rules! define_callbacks { | |||
<$($K)* as keys::Key>::CacheSelector as CacheSelector<'tcx, Erase<$V>> | |||
>::Cache; | |||
|
|||
// Ensure that keys grow no larger than 64 bytes | |||
// Ensure that keys grow no larger than 72 bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not a hard limit? Why was this added in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably perf, but I'm trying to resolve it anyway before going out of draft. I looked up the original PR, and it was just for not accidentally growing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm a bit stuck on CanonicalTypeOpAscribeUserTypeGoal. It's 8 bytes too large now, but there's also nothing that stands out as "this should be interned". Just moving something onto a TyCtxt arena doesn't really seem right to me, that's just avoiding the above size check without adhering to its spirit.
This comment was marked as outdated.
This comment was marked as outdated.
c9357a9
to
05ee8ae
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #122151) made this pull request unmergeable. Please resolve the merge conflicts. |
05ee8ae
to
e3291ea
Compare
☔ The latest upstream changes (presumably #122182) made this pull request unmergeable. Please resolve the merge conflicts. |
e3291ea
to
cb7c75b
Compare
@bors try |
…of waiting until borrowck is done
…ing scope" is actually needed
…formation about the defining anchor
52ab386
to
dc97b1e
Compare
@bors r=lcnr rollup=never |
☀️ Test successful - checks-actions |
Finished benchmarking commit (b234e44): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 669.403s -> 674.046s (0.69%) |
hmm weird, a previous perf run was clean. I must have changed something since then. I'll investigate. |
Ah... dd72bf9 Scraping regions is expensive. I'll implement an alternative. Let's not revert this PR, it's an important bugfix and blocker of a lot of follow up work |
Avoid a scrape_region_constraints and instead register the region constraints directly Should fix the perf regression from rust-lang#122077 (comment)
This eliminates
DefiningAnchor::Bubble
for good and brings the old solver closer to the new one wrt cycles and nested obligations. At that point the difference betweenDefiningAnchor::Bind([])
andDefiningAnchor::Error
was academic. We only used the difference for some sanity checks, which actually had to be worked around in places, so I just removedDefiningAnchor
entirely and just stored the list of opaques that may be defined.fixes #108498
fixes #116877