Skip to content
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

change NormalizesTo to fully structurally normalize #123363

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 2, 2024

notes in https://hackmd.io/wZ016dE4QKGIhrOnHLlThQ

need to also update the dev-guide once this PR lands. in short, the setup is now as follows:

normalizes-to internally implements one step normalization, applying that normalization to the goal.predicate.term causes the projected term to get recursively normalized. With this normalizes-to normalizes until the projected term is rigid, meaning that we normalize as many steps necessary, but at least 1.

To handle rigid aliases, we add another candidate only if the 1 to inf step normalization failed. With this normalizes-to is now full structural normalization. We can now change AliasRelate to simply emit normalizes-to goals for the rhs and lhs.

This avoids the concerns from rust-lang/trait-system-refactor-initiative#103 and generally feels cleaner

@rustbot
Copy link
Collaborator

rustbot commented Apr 2, 2024

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Apr 2, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 2, 2024

Some changes occurred to the core trait solver

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

@lcnr lcnr force-pushed the normalizes-to-zero-to-inf branch from a76a780 to 209632a Compare April 2, 2024 13:21
@lcnr
Copy link
Contributor Author

lcnr commented Apr 2, 2024

TODO: this currently negatively affects perf because the structural norm is now nested alias-relate -> normalizes-to -> alias-relate. Intend to change instantiate_normalizes_to_term to use normalizes_to directly instead

@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 2, 2024

r? @BoxyUwU
would like to review this myself

@rustbot rustbot assigned BoxyUwU and unassigned compiler-errors Apr 2, 2024
@lcnr lcnr force-pushed the normalizes-to-zero-to-inf branch from 209632a to 8c96795 Compare April 4, 2024 10:40
@lcnr
Copy link
Contributor Author

lcnr commented Apr 4, 2024

TODO: this currently negatively affects perf because the structural norm is now nested alias-relate -> normalizes-to -> alias-relate. Intend to change instantiate_normalizes_to_term to use normalizes_to directly instead

Actually doesn't really negatively affect perf compared to the previous impl 🤔 trying the separate approach ends up causing worse perf by propagating more nested goals upwards, causing us to spend a lot more time in try_evaluated_added_goals

@lcnr lcnr force-pushed the normalizes-to-zero-to-inf branch from 8c96795 to 92b280c Compare April 4, 2024 11:04
@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 4, 2024

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Apr 4, 2024

📌 Commit 92b280c has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 4, 2024
@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 4, 2024

i mean @bors rollup=always (new solver)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…BoxyUwU

change `NormalizesTo` to fully structurally normalize

notes in https://hackmd.io/wZ016dE4QKGIhrOnHLlThQ

need to also update the dev-guide once this PR lands. in short, the setup is now as follows:

`normalizes-to` internally implements one step normalization, applying that normalization to the `goal.predicate.term` causes the projected term to get recursively normalized. With this `normalizes-to` normalizes until the projected term is rigid, meaning that we normalize as many steps necessary, but at least 1.

To handle rigid aliases, we add another candidate only if the 1 to inf step normalization failed. With this `normalizes-to` is now full structural normalization. We can now change `AliasRelate` to simply emit `normalizes-to` goals for the rhs and lhs.

This avoids the concerns from rust-lang/trait-system-refactor-initiative#103 and generally feels cleaner
@bors bors merged commit fcb0e9d into rust-lang:master Apr 5, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 5, 2024
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.

None yet

5 participants