Skip to content

Commit 0ff1fb2

Browse files
ywxtZoxc
andcommitted
Restore to HashSet
Co-authored-by: Zoxc <zoxc32@gmail.com>
1 parent 46e18d1 commit 0ff1fb2

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4538,7 +4538,6 @@ version = "0.0.0"
45384538
dependencies = [
45394539
"crossbeam-deque",
45404540
"crossbeam-utils",
4541-
"indexmap",
45424541
"libc",
45434542
"rand 0.9.1",
45444543
"rand_xorshift",

compiler/rustc_thread_pool/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ categories = ["concurrency"]
1616
[dependencies]
1717
crossbeam-deque = "0.8"
1818
crossbeam-utils = "0.8"
19-
indexmap = "2.4.0"
2019
smallvec = "1.8.1"
2120

2221
[dev-dependencies]

compiler/rustc_thread_pool/src/scope/mod.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
//! [`join()`]: ../join/join.fn.html
77
88
use std::any::Any;
9+
use std::collections::HashSet;
910
use std::marker::PhantomData;
1011
use std::mem::ManuallyDrop;
1112
use std::sync::atomic::{AtomicPtr, Ordering};
1213
use std::sync::{Arc, Mutex};
1314
use std::{fmt, ptr};
1415

15-
use indexmap::IndexSet;
16-
1716
use crate::broadcast::BroadcastContext;
1817
use crate::job::{ArcJob, HeapJob, JobFifo, JobRef, JobRefId};
1918
use crate::latch::{CountLatch, Latch};
@@ -55,7 +54,8 @@ struct ScopeBase<'scope> {
5554
job_completed_latch: CountLatch,
5655

5756
/// Jobs that have been spawned, but not yet started.
58-
pending_jobs: Mutex<IndexSet<JobRefId>>,
57+
#[allow(rustc::default_hash_types)]
58+
pending_jobs: Mutex<HashSet<JobRefId>>,
5959

6060
/// The worker which will wait on scope completion, if any.
6161
worker: Option<usize>,
@@ -538,7 +538,7 @@ impl<'scope> Scope<'scope> {
538538
let scope = scope_ptr.as_ref();
539539

540540
// Mark this job is started.
541-
scope.base.pending_jobs.lock().unwrap().swap_remove_full(&id);
541+
scope.base.pending_jobs.lock().unwrap().remove(&id);
542542

543543
ScopeBase::execute_job(&scope.base, move || body(scope))
544544
});
@@ -569,7 +569,7 @@ impl<'scope> Scope<'scope> {
569569
let current_index = WorkerThread::current().as_ref().map(|worker| worker.index());
570570
if current_index == scope.base.worker {
571571
// Mark this job as started on the scope's worker thread.
572-
scope.base.pending_jobs.lock().unwrap().swap_remove(&id);
572+
scope.base.pending_jobs.lock().unwrap().remove(&id);
573573
}
574574

575575
let func = move || BroadcastContext::with(move |ctx| body(scope, ctx));
@@ -611,7 +611,7 @@ impl<'scope> ScopeFifo<'scope> {
611611
let scope = scope_ptr.as_ref();
612612

613613
// Mark this job is started.
614-
scope.base.pending_jobs.lock().unwrap().swap_remove(&id);
614+
scope.base.pending_jobs.lock().unwrap().remove(&id);
615615

616616
ScopeBase::execute_job(&scope.base, move || body(scope))
617617
});
@@ -642,7 +642,7 @@ impl<'scope> ScopeFifo<'scope> {
642642
let current_index = WorkerThread::current().as_ref().map(|worker| worker.index());
643643
if current_index == scope.base.worker {
644644
// Mark this job as started on the scope's worker thread.
645-
scope.base.pending_jobs.lock().unwrap().swap_remove(&id);
645+
scope.base.pending_jobs.lock().unwrap().remove(&id);
646646
}
647647
let body = &body;
648648
let func = move || BroadcastContext::with(move |ctx| body(scope, ctx));
@@ -664,7 +664,8 @@ impl<'scope> ScopeBase<'scope> {
664664
registry: Arc::clone(registry),
665665
panic: AtomicPtr::new(ptr::null_mut()),
666666
job_completed_latch: CountLatch::new(owner),
667-
pending_jobs: Mutex::new(IndexSet::new()),
667+
#[allow(rustc::default_hash_types)]
668+
pending_jobs: Mutex::new(HashSet::new()),
668669
worker: owner.map(|w| w.index()),
669670
marker: PhantomData,
670671
tlv: tlv::get(),

0 commit comments

Comments
 (0)