diff options
| author | Celina G. Val <celinval@amazon.com> | 2025-06-11 12:32:09 -0700 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2025-06-11 16:56:01 -0700 |
| commit | f52c6eee02fb9a9cfe203ce95c4968c2835c034b (patch) | |
| tree | 93d6b6f10a357b37cd68911f6f4b049ccbec5fd8 /compiler/rustc_thread_pool/src/spawn | |
| parent | 4aa62ea9e9015621969a0f505abf7a6894e99e9e (diff) | |
| download | rust-f52c6eee02fb9a9cfe203ce95c4968c2835c034b.tar.gz rust-f52c6eee02fb9a9cfe203ce95c4968c2835c034b.zip | |
Another round of tidy / warning fixes
Diffstat (limited to 'compiler/rustc_thread_pool/src/spawn')
| -rw-r--r-- | compiler/rustc_thread_pool/src/spawn/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_thread_pool/src/spawn/mod.rs b/compiler/rustc_thread_pool/src/spawn/mod.rs index 92b89ed5948..040a02bfa67 100644 --- a/compiler/rustc_thread_pool/src/spawn/mod.rs +++ b/compiler/rustc_thread_pool/src/spawn/mod.rs @@ -50,7 +50,7 @@ use crate::unwind; /// This code creates a Rayon task that increments a global counter. /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; /// /// static GLOBAL_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; @@ -80,7 +80,7 @@ where // be able to panic, and hence the data won't leak but will be // enqueued into some deque for later execution. let abort_guard = unwind::AbortIfPanic; // just in case we are wrong, and code CAN panic - let job_ref = spawn_job(func, registry); + let job_ref = unsafe { spawn_job(func, registry) }; registry.inject_or_push(job_ref); mem::forget(abort_guard); } @@ -150,16 +150,16 @@ where // be able to panic, and hence the data won't leak but will be // enqueued into some deque for later execution. let abort_guard = unwind::AbortIfPanic; // just in case we are wrong, and code CAN panic - let job_ref = spawn_job(func, registry); + let job_ref = unsafe { spawn_job(func, registry) }; // If we're in the pool, use our thread's private fifo for this thread to execute // in a locally-FIFO order. Otherwise, just use the pool's global injector. match registry.current_thread() { - Some(worker) => worker.push_fifo(job_ref), + Some(worker) => unsafe { worker.push_fifo(job_ref) }, None => registry.inject(job_ref), } mem::forget(abort_guard); } #[cfg(test)] -mod test; +mod tests; |
