Skip to content

Commit 664a270

Browse files
authored
Rollup merge of rust-lang#112708 - flip1995:clippy-freezing-pc-with-ice, r=cjgillot
Revert "Don't hold the active queries lock while calling `make_query`" This reverts commit fd3d2d4. This has the side effect, that when Clippy should ICE (during an EarlyPass?) it will fill up the RAM with 2 GB/s and then freezes the PC. I don't know the correct solution, but this is blocking the Clippy sync and might give some people really bad experiences, so this should be reverted ASAP. Reverts rust-lang#112333 r? `@cjgillot` cc `@Zoxc` I only commented this on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60try_print_query_stack.60.20has.20.60ImplicitCtx.60.20during.20.60EarlyPass.60/near/363926180). I should've left a comment on the PR as well. My bad.
2 parents 9b6cfc4 + 68ecff3 commit 664a270

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

compiler/rustc_query_system/src/query/plumbing.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ where
6969
make_query: fn(Qcx, K) -> QueryStackFrame<D>,
7070
jobs: &mut QueryMap<D>,
7171
) -> Option<()> {
72-
let mut active = Vec::new();
73-
7472
#[cfg(parallel_compiler)]
7573
{
7674
// We use try_lock_shards here since we are called from the
@@ -79,7 +77,8 @@ where
7977
for shard in shards.iter() {
8078
for (k, v) in shard.iter() {
8179
if let QueryResult::Started(ref job) = *v {
82-
active.push((*k, job.clone()));
80+
let query = make_query(qcx, *k);
81+
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
8382
}
8483
}
8584
}
@@ -92,18 +91,12 @@ where
9291
// really hurt much.)
9392
for (k, v) in self.active.try_lock()?.iter() {
9493
if let QueryResult::Started(ref job) = *v {
95-
active.push((*k, job.clone()));
94+
let query = make_query(qcx, *k);
95+
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
9696
}
9797
}
9898
}
9999

100-
// Call `make_query` while we're not holding a `self.active` lock as `make_query` may call
101-
// queries leading to a deadlock.
102-
for (key, job) in active {
103-
let query = make_query(qcx, key);
104-
jobs.insert(job.id, QueryJobInfo { query, job });
105-
}
106-
107100
Some(())
108101
}
109102
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// compile-flags: -Ztreat-err-as-bug
2+
// dont-check-failure-status
3+
// error-pattern: aborting due to `-Z treat-err-as-bug=1`
4+
// normalize-stderr-test "note: .*\n\n" -> ""
5+
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
6+
// rustc-env:RUST_BACKTRACE=0
7+
8+
fn main() {
9+
#[deny(while_true)]
10+
while true {}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: denote infinite loops with `loop { ... }`
2+
--> $DIR/panic-causes-oom-112708.rs:10:5
3+
|
4+
LL | while true {}
5+
| ^^^^^^^^^^ help: use `loop`
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/panic-causes-oom-112708.rs:9:12
9+
|
10+
LL | #[deny(while_true)]
11+
| ^^^^^^^^^^
12+
13+
error: the compiler unexpectedly panicked. this is a bug.
14+
15+
query stack during panic:
16+
thread panicked while processing panic. aborting.

0 commit comments

Comments
 (0)