From 5f3042e56f0f03c4ef3a0fd87b63b237c2849c6e Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 12 Mar 2026 09:20:07 +1100 Subject: [PATCH] Refactor and speed up `ActiveGuardDrop`. To fix a small perf regression from #153471. --- compiler/rustc_query_impl/src/execution.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_query_impl/src/execution.rs b/compiler/rustc_query_impl/src/execution.rs index eae91a2b2e566..c1da365c5ca94 100644 --- a/compiler/rustc_query_impl/src/execution.rs +++ b/compiler/rustc_query_impl/src/execution.rs @@ -164,10 +164,10 @@ where let mut this = ManuallyDrop::new(self); // Drop everything without poisoning the query. - this.drop_and_maybe_poison(/* poison */ false); + this.drop_and_maybe_poison::(); } - fn drop_and_maybe_poison(&mut self, poison: bool) { + fn drop_and_maybe_poison(&mut self) { let status = { let mut shard = self.state.active.lock_shard_by_hash(self.key_hash); match shard.find_entry(self.key_hash, equivalent_key(self.key)) { @@ -179,7 +179,7 @@ where } Ok(occupied) => { let ((key, status), vacant) = occupied.remove(); - if poison { + if POISON { vacant.insert((key, ActiveKeyStatus::Poisoned)); } status @@ -203,7 +203,7 @@ where #[cold] fn drop(&mut self) { // Poison the query so jobs waiting on it panic. - self.drop_and_maybe_poison(/* poison */ true); + self.drop_and_maybe_poison::(); } }