about summary refs log tree commit diff
path: root/compiler/rustc_thread_pool
diff options
context:
space:
mode:
authorywxt <ywxtcwh@gmail.com>2025-06-27 10:37:55 +0800
committerywxt <ywxtcwh@gmail.com>2025-06-28 17:58:21 +0800
commit0ff1fb27d3cbfdc1e9fd7598842eaab588e3c69e (patch)
tree212edde5cd4f2fdafbdbc8e1c9ce765312d23435 /compiler/rustc_thread_pool
parent46e18d1fe048a80613afacb05472d3eb44cec535 (diff)
downloadrust-0ff1fb27d3cbfdc1e9fd7598842eaab588e3c69e.tar.gz
rust-0ff1fb27d3cbfdc1e9fd7598842eaab588e3c69e.zip
Restore to HashSet
Co-authored-by: Zoxc <zoxc32@gmail.com>
Diffstat (limited to 'compiler/rustc_thread_pool')
-rw-r--r--compiler/rustc_thread_pool/Cargo.toml1
-rw-r--r--compiler/rustc_thread_pool/src/scope/mod.rs17
2 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_thread_pool/Cargo.toml b/compiler/rustc_thread_pool/Cargo.toml
index c73c7961cbc..b0194834264 100644
--- a/compiler/rustc_thread_pool/Cargo.toml
+++ b/compiler/rustc_thread_pool/Cargo.toml
@@ -16,7 +16,6 @@ categories = ["concurrency"]
 [dependencies]
 crossbeam-deque = "0.8"
 crossbeam-utils = "0.8"
-indexmap = "2.4.0"
 smallvec = "1.8.1"
 
 [dev-dependencies]
diff --git a/compiler/rustc_thread_pool/src/scope/mod.rs b/compiler/rustc_thread_pool/src/scope/mod.rs
index b6601d0cbcc..38230383965 100644
--- a/compiler/rustc_thread_pool/src/scope/mod.rs
+++ b/compiler/rustc_thread_pool/src/scope/mod.rs
@@ -6,14 +6,13 @@
 //! [`join()`]: ../join/join.fn.html
 
 use std::any::Any;
+use std::collections::HashSet;
 use std::marker::PhantomData;
 use std::mem::ManuallyDrop;
 use std::sync::atomic::{AtomicPtr, Ordering};
 use std::sync::{Arc, Mutex};
 use std::{fmt, ptr};
 
-use indexmap::IndexSet;
-
 use crate::broadcast::BroadcastContext;
 use crate::job::{ArcJob, HeapJob, JobFifo, JobRef, JobRefId};
 use crate::latch::{CountLatch, Latch};
@@ -55,7 +54,8 @@ struct ScopeBase<'scope> {
     job_completed_latch: CountLatch,
 
     /// Jobs that have been spawned, but not yet started.
-    pending_jobs: Mutex<IndexSet<JobRefId>>,
+    #[allow(rustc::default_hash_types)]
+    pending_jobs: Mutex<HashSet<JobRefId>>,
 
     /// The worker which will wait on scope completion, if any.
     worker: Option<usize>,
@@ -538,7 +538,7 @@ impl<'scope> Scope<'scope> {
             let scope = scope_ptr.as_ref();
 
             // Mark this job is started.
-            scope.base.pending_jobs.lock().unwrap().swap_remove_full(&id);
+            scope.base.pending_jobs.lock().unwrap().remove(&id);
 
             ScopeBase::execute_job(&scope.base, move || body(scope))
         });
@@ -569,7 +569,7 @@ impl<'scope> Scope<'scope> {
             let current_index = WorkerThread::current().as_ref().map(|worker| worker.index());
             if current_index == scope.base.worker {
                 // Mark this job as started on the scope's worker thread.
-                scope.base.pending_jobs.lock().unwrap().swap_remove(&id);
+                scope.base.pending_jobs.lock().unwrap().remove(&id);
             }
 
             let func = move || BroadcastContext::with(move |ctx| body(scope, ctx));
@@ -611,7 +611,7 @@ impl<'scope> ScopeFifo<'scope> {
             let scope = scope_ptr.as_ref();
 
             // Mark this job is started.
-            scope.base.pending_jobs.lock().unwrap().swap_remove(&id);
+            scope.base.pending_jobs.lock().unwrap().remove(&id);
 
             ScopeBase::execute_job(&scope.base, move || body(scope))
         });
@@ -642,7 +642,7 @@ impl<'scope> ScopeFifo<'scope> {
             let current_index = WorkerThread::current().as_ref().map(|worker| worker.index());
             if current_index == scope.base.worker {
                 // Mark this job as started on the scope's worker thread.
-                scope.base.pending_jobs.lock().unwrap().swap_remove(&id);
+                scope.base.pending_jobs.lock().unwrap().remove(&id);
             }
             let body = &body;
             let func = move || BroadcastContext::with(move |ctx| body(scope, ctx));
@@ -664,7 +664,8 @@ impl<'scope> ScopeBase<'scope> {
             registry: Arc::clone(registry),
             panic: AtomicPtr::new(ptr::null_mut()),
             job_completed_latch: CountLatch::new(owner),
-            pending_jobs: Mutex::new(IndexSet::new()),
+            #[allow(rustc::default_hash_types)]
+            pending_jobs: Mutex::new(HashSet::new()),
             worker: owner.map(|w| w.index()),
             marker: PhantomData,
             tlv: tlv::get(),