Skip to content

Do not cache lints_that_dont_need_to_run across sessions#156214

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
qaijuang:fix-lints-that-dont-need-to-run-incr
May 8, 2026
Merged

Do not cache lints_that_dont_need_to_run across sessions#156214
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
qaijuang:fix-lints-that-dont-need-to-run-incr

Conversation

@qaijuang
Copy link
Copy Markdown
Contributor

@qaijuang qaijuang commented May 5, 2026

The lints_that_dont_need_to_run query depends on the lint store (which includes internal lints under -Zunstable-options). Because that flag is deliberately not part of the incremental command-line hash, incremental builds could load stale results from sessions with a different lint configuration, leading to an ICE.

This PR marks the query eval_always so it is recomputed for the current session instead of being loaded from cache.

Fixes #156182.

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

rustbot commented May 5, 2026

r? @folkertdev

rustbot has assigned @folkertdev.
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
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@folkertdev
Copy link
Copy Markdown
Contributor

This looks reasonable, but with the query system I might be missing something

r? nnethercote

@rustbot rustbot assigned nnethercote and unassigned folkertdev May 6, 2026
Copy link
Copy Markdown
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

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

We should be aware of any perf impact

@bors try @rust-timer queue

View changes since this review

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 7, 2026
…, r=<try>

Do not cache `lints_that_dont_need_to_run` across sessions
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 8, 2026

☀️ Try build successful (CI)
Build commit: 5979723 (59797239a124012bcebbba8dd384c353b75d3536, parent: ffccab6abef68b70c5e23cfbfb1ac7680104040d)

@nnethercote
Copy link
Copy Markdown
Contributor

Also seems reasonable to me. @Zalathar, what do you think?

@Zalathar
Copy link
Copy Markdown
Member

Zalathar commented May 8, 2026

Looks reasonable to me.

If lints_that_dont_need_to_run can return different results based on untracked state, then it should indeed be marked eval_always.

Note that strictly speaking, we already don't cache the value of the lints_that_dont_need_to_run query on disk. So I suspect the actual problem is that we record incorrect dependency information on disk, causing one or more downstream query values or side-effects to be loaded from disk when they shouldn't be.

@Zalathar
Copy link
Copy Markdown
Member

Zalathar commented May 8, 2026

It's possible that we should have a dedicated query for accessing the lint store from tcx, so that all downstream code has the right dependency tracking automatically, instead of having to manually tag queries like lints_that_dont_need_to_run.

But I think it's fine to not let those possible follow-ups block this particular fix.

@nnethercote
Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 8, 2026

📌 Commit 0f43788 has been approved by nnethercote

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 May 8, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 8, 2026
…to-run-incr, r=nnethercote

Do not cache `lints_that_dont_need_to_run` across sessions

The `lints_that_dont_need_to_run` query depends on the lint store (which includes internal lints under `-Zunstable-options`). Because that flag is deliberately not part of the incremental command-line hash, incremental builds could load stale results from sessions with a different lint configuration, leading to an ICE.

This PR marks the query `eval_always` so it is recomputed for the current session instead of being loaded from cache.

Fixes rust-lang#156182.
rust-bors Bot pushed a commit that referenced this pull request May 8, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #156236 (resolve: Remove `MacroData`)
 - #156298 (Rename the unstable integer `extend` function to `widen`)
 - #156214 (Do not cache `lints_that_dont_need_to_run` across sessions)
rust-bors Bot pushed a commit that referenced this pull request May 8, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #156236 (resolve: Remove `MacroData`)
 - #156298 (Rename the unstable integer `extend` function to `widen`)
 - #154498 (turn some long-deprecated -C options into errors)
 - #155734 (Reject outer attributes on `cfg_select` branches)
 - #156123 (Simplify the creation of synthetic HIR.)
 - #156175 (Dep graph cleanups)
 - #156214 (Do not cache `lints_that_dont_need_to_run` across sessions)
rust-bors Bot pushed a commit that referenced this pull request May 8, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #156236 (resolve: Remove `MacroData`)
 - #156298 (Rename the unstable integer `extend` function to `widen`)
 - #154498 (turn some long-deprecated -C options into errors)
 - #155734 (Reject outer attributes on `cfg_select` branches)
 - #156123 (Simplify the creation of synthetic HIR.)
 - #156175 (Dep graph cleanups)
 - #156214 (Do not cache `lints_that_dont_need_to_run` across sessions)
rust-timer added a commit that referenced this pull request May 8, 2026
Rollup merge of #156214 - qaijuang:fix-lints-that-dont-need-to-run-incr, r=nnethercote

Do not cache `lints_that_dont_need_to_run` across sessions

The `lints_that_dont_need_to_run` query depends on the lint store (which includes internal lints under `-Zunstable-options`). Because that flag is deliberately not part of the incremental command-line hash, incremental builds could load stale results from sessions with a different lint configuration, leading to an ICE.

This PR marks the query `eval_always` so it is recomputed for the current session instead of being loaded from cache.

Fixes #156182.
@rust-bors rust-bors Bot merged commit 565ee37 into rust-lang:main May 8, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 8, 2026
@qaijuang qaijuang deleted the fix-lints-that-dont-need-to-run-incr branch May 9, 2026 07:13
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: incremental compilation error with lints_that_dont_need_to_run after enabling -Zpublic-dependency

6 participants