Skip to content

Commit 565ee37

Browse files
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.
2 parents 91d4f8b + 0f43788 commit 565ee37

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

compiler/rustc_middle/src/queries.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ rustc_queries! {
565565

566566
query lints_that_dont_need_to_run(_: ()) -> &'tcx UnordSet<LintId> {
567567
arena_cache
568+
// This depends on the lint store, which includes internal lints when the
569+
// untracked `-Zunstable-options` flag is set.
570+
eval_always
568571
desc { "Computing all lints that are explicitly enabled or with a default level greater than Allow" }
569572
}
570573

tests/incremental/commandline-args.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// Test that changing a tracked commandline argument invalidates
22
// the cache while changing an untracked one doesn't.
33

4-
//@ revisions:rpass1 rpass2 rpass3 rpass4
4+
//@ revisions:rpass1 rpass2 rpass3 rpass4 rpass5
55
//@ compile-flags: -Z query-dep-graph
66

77
#![feature(rustc_attrs)]
88

99
#![rustc_partition_codegened(module="commandline_args", cfg="rpass2")]
1010
#![rustc_partition_reused(module="commandline_args", cfg="rpass3")]
1111
#![rustc_partition_codegened(module="commandline_args", cfg="rpass4")]
12+
#![rustc_partition_reused(module="commandline_args", cfg="rpass5")]
1213

1314
// Between revisions 1 and 2, we are changing the debuginfo-level, which should
1415
// invalidate the cache. Between revisions 2 and 3, we are adding `--diagnostic-width`
@@ -18,6 +19,10 @@
1819
//@[rpass2] compile-flags: -C debuginfo=2
1920
//@[rpass3] compile-flags: -C debuginfo=2 --diagnostic-width=80
2021
//@[rpass4] compile-flags: -C debuginfo=2 --diagnostic-width=80 --remap-path-prefix=/home/bors/r=src
22+
// Regression test for https://github.com/rust-lang/rust/issues/156182.
23+
// `-Zunstable-options` enables internal lints, so the lint store changes without
24+
// changing the incremental command-line hash.
25+
//@[rpass5] compile-flags: -C debuginfo=2 --diagnostic-width=80 --remap-path-prefix=/home/bors/r=src -Zunstable-options
2126
//@ ignore-backends: gcc
2227

2328
pub fn main() {

0 commit comments

Comments
 (0)