Skip to content

search graph: lazily update parent goals #144955

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 Aug 5, 2025

Based on top of #143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:

  • We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling fn update_parent_goal
  • Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information has to be integrated in the StackEntry of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? @compiler-errors @BoxyUwU

@rustbot
Copy link
Collaborator

rustbot commented Aug 5, 2025

compiler-errors is not on the review rotation at the moment.
They may take a while to respond.

@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 Aug 5, 2025
@lcnr lcnr force-pushed the lazily-update-non-parent-goals branch 2 times, most recently from eaf0086 to f4f80a7 Compare August 5, 2025 12:46
@lcnr lcnr force-pushed the lazily-update-non-parent-goals branch 2 times, most recently from 92fe150 to 48f67bb Compare August 5, 2025 13:29
@lcnr lcnr force-pushed the lazily-update-non-parent-goals branch 2 times, most recently from d34a2c3 to a6f50d5 Compare August 11, 2025 13:49
@BoxyUwU
Copy link
Member

BoxyUwU commented Aug 11, 2025

r=me after other PR lands and CI passes

@BoxyUwU
Copy link
Member

BoxyUwU commented Aug 11, 2025

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned compiler-errors Aug 11, 2025
@BoxyUwU BoxyUwU added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 11, 2025
@bors
Copy link
Collaborator

bors commented Aug 12, 2025

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

@lcnr lcnr force-pushed the lazily-update-non-parent-goals branch from a6f50d5 to db1a64c Compare August 12, 2025 08:08
@lcnr
Copy link
Contributor Author

lcnr commented Aug 12, 2025

@bors r=BoxyUwU rollup

@bors
Copy link
Collaborator

bors commented Aug 12, 2025

📌 Commit db1a64c 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-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Aug 12, 2025
Kobzol added a commit to Kobzol/rust that referenced this pull request Aug 12, 2025
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? `@compiler-errors` `@BoxyUwU`
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 12, 2025
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? ``@compiler-errors`` ``@BoxyUwU``
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 12, 2025
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? ```@compiler-errors``` ```@BoxyUwU```
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 12, 2025
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? ````@compiler-errors```` ````@BoxyUwU````
bors added a commit that referenced this pull request Aug 12, 2025
Rollup of 7 pull requests

Successful merges:

 - #144642 (editorconfig: don't trim trailing whitespace in tests)
 - #144955 (search graph: lazily update parent goals)
 - #145153 (Handle macros with multiple kinds, and improve errors)
 - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens)
 - #145269 (Deprecate RUST_TEST_* env variables)
 - #145289 (chore(ci): upgrade checkout to v5)
 - #145303 (Docs: Link to payload_as_str() from payload().)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 13, 2025
Rollup of 7 pull requests

Successful merges:

 - #144642 (editorconfig: don't trim trailing whitespace in tests)
 - #144955 (search graph: lazily update parent goals)
 - #145153 (Handle macros with multiple kinds, and improve errors)
 - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens)
 - #145269 (Deprecate RUST_TEST_* env variables)
 - #145289 (chore(ci): upgrade checkout to v5)
 - #145303 (Docs: Link to payload_as_str() from payload().)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 13, 2025
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? `````@compiler-errors````` `````@BoxyUwU`````
jdonszelmann added a commit to jdonszelmann/rust that referenced this pull request Aug 13, 2025
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

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