Skip to content

Make setup_dep_graph incremental-only and more straightforward #154529

Open
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:setup-dep-graph
Open

Make setup_dep_graph incremental-only and more straightforward #154529
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:setup-dep-graph

Conversation

@Zalathar
Copy link
Copy Markdown
Member

The existing code contains some very strange control flow that can put the dep graph into an inconsistent and untested state if streaming output setup fails.

(Specifically, that failure would put DepGraph into an "empty" state intended for non-incremental compilation, but other parts of the compiler would still think that incremental mode is enabled due to sess.opts.incremental.)

This PR therefore performs a big overhaul of setup_dep_graph by:

  • Returning immediately in non-incremental mode.
  • Exiting immediately if dep-graph streaming output couldn't be set up.
  • Inlining some "helper" functions that were more confusing than helpful.

Moving this code here makes the subsequent cleanup easier.
The existing code contains some very strange control flow that can put the dep
graph into an inconsistent and untested state if streaming output setup fails.

(Specifically, that failure would put `DepGraph` into an "empty" state intended
for non-incremental compilation, but other parts of the compiler would still
think that incremental mode is enabled due to `sess.opts.incremental`.)

This commit therefore performs a big overhaul of `setup_dep_graph` by:

- Returning immediately in non-incremental mode.
- Exiting immediately if dep-graph streaming output couldn't be set up.
- Inlining some "helper" functions that were more confusing than helpful.
- Make the enum non-public
- Replace the generic `<T>` with concrete fields
- Rename variant `LoadDepGraph` to `IoError`
@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. labels Mar 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 29, 2026

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, incremental
  • compiler, incremental expanded to 69 candidates
  • Random selection from 13 candidates

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants