Skip to content

Conversation

compiler-errors
Copy link
Member

We normalize the hidden type of an opaque before defining it to ensure that we don't:

  1. Infer a hidden type that is normalizes to the opaque directly
  2. Infer a hidden type that normalizes to an infer var, which can then be set to the opaque

Tests are a combination of things that went from ICE -> (expected) fail, and fail -> pass.

r? lcnr

@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 Oct 3, 2023
@rustbot
Copy link
Collaborator

rustbot commented Oct 3, 2023

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 new-solver-opaques branch from e4952af to 7cf15d6 Compare October 3, 2023 03:43
@rust-log-analyzer

This comment has been minimized.

@rust-cloud-vms rust-cloud-vms bot force-pushed the new-solver-opaques branch from 7cf15d6 to 0fa553a Compare October 3, 2023 04:02
@bors
Copy link
Collaborator

bors commented Oct 10, 2023

☔ The latest upstream changes (presumably #116598) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Collaborator

bors commented Oct 21, 2023

☔ The latest upstream changes (presumably #116958) made this pull request unmergeable. Please resolve the merge conflicts.

@compiler-errors
Copy link
Member Author

Closing in favor of @lcnr's approach.

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 17, 2023
…rors

new solver normalization improvements

cool beans

At the core of this PR is a `try_normalize_ty` which stops for rigid aliases by using `commit_if_ok`.

Reworks alias-relate to fully normalize both the lhs and rhs and then equate the resulting rigid (or inference) types. This fixes rust-lang/trait-system-refactor-initiative#68 by avoiding the exponential blowup. Also supersedes rust-lang#116369 by only defining opaque types if the hidden type is rigid.

I removed the stability check in `EvalCtxt::evaluate_goal` due to rust-lang/trait-system-refactor-initiative#75. While I personally have opinions on how to fix it, that still requires further t-types/`@nikomatsakis` buy-in, so I removed that for now. Once we've decided on our approach there, we can revert this commit.

r? `@compiler-errors`
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.

6 participants