Skip to content

support duplicate entries in the opaque_type_storage#140607

Merged
bors merged 1 commit intorust-lang:masterfrom
lcnr:opaque-type-storage
May 7, 2025
Merged

support duplicate entries in the opaque_type_storage#140607
bors merged 1 commit intorust-lang:masterfrom
lcnr:opaque-type-storage

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

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