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/scope | |
| parent | 4aa62ea9e9015621969a0f505abf7a6894e99e9e (diff) | |
Another round of tidy / warning fixes
Diffstat (limited to 'compiler/rustc_thread_pool/src/scope')
| -rw-r--r-- | compiler/rustc_thread_pool/src/scope/mod.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_thread_pool/src/scope/mod.rs b/compiler/rustc_thread_pool/src/scope/mod.rs index 82b3d053dcb..55e58b3509d 100644 --- a/compiler/rustc_thread_pool/src/scope/mod.rs +++ b/compiler/rustc_thread_pool/src/scope/mod.rs @@ -20,7 +20,7 @@ use crate::tlv::{self, Tlv}; use crate::unwind; #[cfg(test)] -mod test; +mod tests; /// Represents a fork-join scope which can be used to spawn any number of tasks. /// See [`scope()`] for more information. @@ -84,7 +84,7 @@ struct ScopeBase<'scope> { /// it would be less efficient than the real implementation: /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// pub fn join<A,B,RA,RB>(oper_a: A, oper_b: B) -> (RA, RB) /// where A: FnOnce() -> RA + Send, /// B: FnOnce() -> RB + Send, @@ -125,7 +125,7 @@ struct ScopeBase<'scope> { /// To see how and when tasks are joined, consider this example: /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// // point start /// rayon::scope(|s| { /// s.spawn(|s| { // task s.1 @@ -193,7 +193,7 @@ struct ScopeBase<'scope> { /// spawned task. /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// let ok: Vec<i32> = vec![1, 2, 3]; /// rayon::scope(|s| { /// let bad: Vec<i32> = vec![4, 5, 6]; @@ -217,7 +217,7 @@ struct ScopeBase<'scope> { /// in this case including both `ok` *and* `bad`: /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// let ok: Vec<i32> = vec![1, 2, 3]; /// rayon::scope(|s| { /// let bad: Vec<i32> = vec![4, 5, 6]; @@ -238,7 +238,7 @@ struct ScopeBase<'scope> { /// is a borrow of `ok` and capture *that*: /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// let ok: Vec<i32> = vec![1, 2, 3]; /// rayon::scope(|s| { /// let bad: Vec<i32> = vec![4, 5, 6]; @@ -260,7 +260,7 @@ struct ScopeBase<'scope> { /// of individual variables: /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// let ok: Vec<i32> = vec![1, 2, 3]; /// rayon::scope(|s| { /// let bad: Vec<i32> = vec![4, 5, 6]; @@ -312,7 +312,7 @@ where /// [`scope()`]: fn.scope.html /// /// ```rust -/// # use rustc_thred_pool as rayon; +/// # use rustc_thread_pool as rayon; /// // point start /// rayon::scope_fifo(|s| { /// s.spawn_fifo(|s| { // task s.1 @@ -487,7 +487,7 @@ impl<'scope> Scope<'scope> { /// # Examples /// /// ```rust - /// # use rustc_thred_pool as rayon; + /// # use rustc_thread_pool as rayon; /// let mut value_a = None; /// let mut value_b = None; /// let mut value_c = None; @@ -686,7 +686,7 @@ impl<'scope> ScopeBase<'scope> { where FUNC: FnOnce(), { - let _: Option<()> = Self::execute_job_closure(this, func); + let _: Option<()> = unsafe { Self::execute_job_closure(this, func) }; } /// Executes `func` as a job in scope. Adjusts the "job completed" @@ -699,11 +699,11 @@ impl<'scope> ScopeBase<'scope> { let result = match unwind::halt_unwinding(func) { Ok(r) => Some(r), Err(err) => { - (*this).job_panicked(err); + unsafe { (*this).job_panicked(err) }; None } }; - Latch::set(&(*this).job_completed_latch); + unsafe { Latch::set(&(*this).job_completed_latch) }; result } @@ -778,6 +778,6 @@ unsafe impl<T: Sync> Sync for ScopePtr<T> {} impl<T> ScopePtr<T> { // Helper to avoid disjoint captures of `scope_ptr.0` unsafe fn as_ref(&self) -> &T { - &*self.0 + unsafe { &*self.0 } } } |
