Skip to content

Remove nodes_in_current_session field and related assertions#154283

Open
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:rem-nodes_in_current_session
Open

Remove nodes_in_current_session field and related assertions#154283
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:rem-nodes_in_current_session

Conversation

@Zoxc
Copy link
Copy Markdown
Contributor

@Zoxc Zoxc commented Mar 24, 2026

This removes the nodes_in_current_session field and related assertions. These are enabled if -Z incremental-verify-ich is passed or debug_assertions is on. Historically these have been useful to catch query keys with improper HashStable impls which lead to collisions.

We currently also check for duplicate nodes when loading the dep graph. This check is more complete as it covers the entire dep graph and is enabled by default. It doesn't provide a query key for a collision however. This check is also delayed to the next incremental session.

We also have the verify_query_key_hashes which is also enabled if -Z incremental-verify-ich is passed or debug_assertions is on. This checks for dep node conflicts in each query cache and provides 2 conflicting keys if present.

I think these remaining checks are sufficient and so we can remove nodes_in_current_session.

@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 24, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 24, 2026

r? @jdonszelmann

rustbot has assigned @jdonszelmann.
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, query-system
  • compiler, incremental, query-system expanded to 69 candidates
  • Random selection from 12 candidates

@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Mar 24, 2026

@rust-log-analyzer

This comment has been minimized.

@Zoxc Zoxc force-pushed the rem-nodes_in_current_session branch from 922660c to 267d6cf Compare March 24, 2026 00:49
@jdonszelmann
Copy link
Copy Markdown
Contributor

This looks reasonable to me, but I'm no expert on the query system. Going to defer to @nnethercote (or someone else if that's better)

r? @nnethercote

@rustbot rustbot assigned nnethercote and unassigned jdonszelmann Apr 2, 2026
Copy link
Copy Markdown
Contributor

@nnethercote nnethercote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one nit below.

View changes since this review

}

#[cfg(debug_assertions)]
fn record_edge(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep this entire function cfg(debug_assertions), and then likewise at the call sites. It makes it clearer that it's all debug-only, and avoids the need for the underscores on the parameter names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of just converting this to cfg!.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[cfg] makes the call sites clearer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?
I basically always prefer if cfg! to #[cfg] when technically possible because it doesn't hide the configured-out code from type checker and other later passes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, whatever, just do cfg! then.

@nnethercote nnethercote added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

6 participants