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 2 commits 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 from f4f80a7 to 92fe150 Compare August 5, 2025 12:48
@lcnr lcnr force-pushed the lazily-update-non-parent-goals branch from 92fe150 to 48f67bb Compare August 5, 2025 13:29
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.

3 participants