Skip to content

support duplicate entries in the opaque_type_storage #140607

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented May 3, 2025

Necessary for the new solver as we may unify keys when eagerly resolving for canonical queries. See the relevant comment when instantiating query responses:

            // We eagerly resolve inference variables when computing the query response.
            // This can cause previously distinct opaque type keys to now be structurally equal.
            //
            // To handle this, we store any duplicate entries in a separate list to check them
            // at the end of typeck/borrowck. We could alternatively eagerly equate the hidden
            // types here. However, doing so is difficult as it may result in nested goals and
            // any errors may make it harder to track the control flow for diagnostics.
            if let Some(prev) = prev {
                self.delegate.add_duplicate_opaque_type(key, prev, self.origin_span);
            }

This will be far more relevant with #140497.

r? @compiler-errors

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 3, 2025
@rustbot
Copy link
Collaborator

rustbot commented May 3, 2025

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@rust-cloud-vms rust-cloud-vms bot force-pushed the opaque-type-storage branch from 5d4793b to a714e28 Compare May 3, 2025 03:45
@lcnr
Copy link
Contributor Author

lcnr commented May 3, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 3, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 3, 2025
support duplicate entries in the opaque_type_storage

Necessary for the new solver as we may unify keys when eagerly resolving for canonical queries. See the relevant comment when instantiating query responses:
```rust
            // We eagerly resolve inference variables when computing the query response.
            // This can cause previously distinct opaque type keys to now be structurally equal.
            //
            // To handle this, we store any duplicate entries in a separate list to check them
            // at the end of typeck/borrowck. We could alternatively eagerly equate the hidden
            // types here. However, doing so is difficult as it may result in nested goals and
            // any errors may make it harder to track the control flow for diagnostics.
            if let Some(prev) = prev {
                self.delegate.add_duplicate_opaque_type(key, prev, self.origin_span);
            }
```

This will be far more relevant with rust-lang#140497.

r? `@compiler-errors`
@bors
Copy link
Collaborator

bors commented May 3, 2025

⌛ Trying commit a714e28 with merge 93308d9...

@bors
Copy link
Collaborator

bors commented May 3, 2025

☀️ Try build successful - checks-actions
Build commit: 93308d9 (93308d94b2869be5d252948a335d86db7f041654)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (93308d9): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

This 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.

mean range count
Regressions ❌
(primary)
0.6% [0.4%, 1.3%] 21
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.6% [-6.6%, -0.5%] 6
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-6.6%, 1.3%] 27

Cycles

Results (primary -0.6%, secondary -1.8%)

This 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.

mean range count
Regressions ❌
(primary)
0.5% [0.4%, 0.6%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-1.5%, -0.4%] 19
Improvements ✅
(secondary)
-1.8% [-2.1%, -1.4%] 3
All ❌✅ (primary) -0.6% [-1.5%, 0.6%] 22

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 769.364s -> 769.01s (-0.05%)
Artifact size: 365.54 MiB -> 365.46 MiB (-0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 3, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the opaque-type-storage branch from a714e28 to dd5361f Compare May 3, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants