diff options
| author | Celina G. Val <celinval@amazon.com> | 2025-06-11 11:45:06 -0700 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2025-06-11 12:26:42 -0700 |
| commit | 4aa62ea9e9015621969a0f505abf7a6894e99e9e (patch) | |
| tree | 0fee7d64957aef4f6634319edc073b4557f747f0 /compiler/rustc_thread_pool | |
| parent | 0b9b1df0064396708a5e5ca27fd010ae3ad3a305 (diff) | |
| download | rust-4aa62ea9e9015621969a0f505abf7a6894e99e9e.tar.gz rust-4aa62ea9e9015621969a0f505abf7a6894e99e9e.zip | |
Use `rustc_thread_pool` instead of `rustc-rayon-core`
Diffstat (limited to 'compiler/rustc_thread_pool')
18 files changed, 39 insertions, 45 deletions
diff --git a/compiler/rustc_thread_pool/Cargo.toml b/compiler/rustc_thread_pool/Cargo.toml index f7a3d1306b4..d0bd065c457 100644 --- a/compiler/rustc_thread_pool/Cargo.toml +++ b/compiler/rustc_thread_pool/Cargo.toml @@ -1,25 +1,19 @@ [package] -name = "rustc-rayon-core" -version = "0.5.1" +name = "rustc_thread_pool" +version = "0.0.0" authors = ["Niko Matsakis <niko@alum.mit.edu>", "Josh Stone <cuviper@gmail.com>"] description = "Core APIs for Rayon - fork for rustc" license = "MIT OR Apache-2.0" -repository = "https://github.com/rust-lang/rustc-rayon" -documentation = "https://docs.rs/rustc-rayon-core/" rust-version = "1.63" edition = "2021" readme = "README.md" keywords = ["parallel", "thread", "concurrency", "join", "performance"] categories = ["concurrency"] -[lib] -name = "rayon_core" - -# Some dependencies may not be their latest version, in order to support older rustc. [dependencies] -crossbeam-deque = "0.8.1" -crossbeam-utils = "0.8.0" +crossbeam-deque = "0.8" +crossbeam-utils = "0.8" [dev-dependencies] rand = "0.9" diff --git a/compiler/rustc_thread_pool/src/compile_fail/quicksort_race1.rs b/compiler/rustc_thread_pool/src/compile_fail/quicksort_race1.rs index 5615033895a..1f7a7b0b429 100644 --- a/compiler/rustc_thread_pool/src/compile_fail/quicksort_race1.rs +++ b/compiler/rustc_thread_pool/src/compile_fail/quicksort_race1.rs @@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) { let mid = partition(v); let (lo, _hi) = v.split_at_mut(mid); - rayon_core::join(|| quick_sort(lo), || quick_sort(lo)); //~ ERROR + rustc_thred_pool::join(|| quick_sort(lo), || quick_sort(lo)); //~ ERROR } fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize { diff --git a/compiler/rustc_thread_pool/src/compile_fail/quicksort_race2.rs b/compiler/rustc_thread_pool/src/compile_fail/quicksort_race2.rs index 020589c29a8..71b695dd855 100644 --- a/compiler/rustc_thread_pool/src/compile_fail/quicksort_race2.rs +++ b/compiler/rustc_thread_pool/src/compile_fail/quicksort_race2.rs @@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) { let mid = partition(v); let (lo, _hi) = v.split_at_mut(mid); - rayon_core::join(|| quick_sort(lo), || quick_sort(v)); //~ ERROR + rustc_thred_pool::join(|| quick_sort(lo), || quick_sort(v)); //~ ERROR } fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize { diff --git a/compiler/rustc_thread_pool/src/compile_fail/quicksort_race3.rs b/compiler/rustc_thread_pool/src/compile_fail/quicksort_race3.rs index 16fbf3b824d..8484cebaae8 100644 --- a/compiler/rustc_thread_pool/src/compile_fail/quicksort_race3.rs +++ b/compiler/rustc_thread_pool/src/compile_fail/quicksort_race3.rs @@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) { let mid = partition(v); let (_lo, hi) = v.split_at_mut(mid); - rayon_core::join(|| quick_sort(hi), || quick_sort(hi)); //~ ERROR + rustc_thred_pool::join(|| quick_sort(hi), || quick_sort(hi)); //~ ERROR } fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize { diff --git a/compiler/rustc_thread_pool/src/compile_fail/rc_return.rs b/compiler/rustc_thread_pool/src/compile_fail/rc_return.rs index 93e3a603849..509c8d62ad1 100644 --- a/compiler/rustc_thread_pool/src/compile_fail/rc_return.rs +++ b/compiler/rustc_thread_pool/src/compile_fail/rc_return.rs @@ -2,7 +2,7 @@ use std::rc::Rc; -rayon_core::join(|| Rc::new(22), || ()); //~ ERROR +rustc_thred_pool::join(|| Rc::new(22), || ()); //~ ERROR ``` */ mod left {} @@ -11,7 +11,7 @@ mod left {} use std::rc::Rc; -rayon_core::join(|| (), || Rc::new(23)); //~ ERROR +rustc_thred_pool::join(|| (), || Rc::new(23)); //~ ERROR ``` */ mod right {} diff --git a/compiler/rustc_thread_pool/src/compile_fail/rc_upvar.rs b/compiler/rustc_thread_pool/src/compile_fail/rc_upvar.rs index d8aebcfcbf2..a27b3c8c39f 100644 --- a/compiler/rustc_thread_pool/src/compile_fail/rc_upvar.rs +++ b/compiler/rustc_thread_pool/src/compile_fail/rc_upvar.rs @@ -3,7 +3,7 @@ use std::rc::Rc; let r = Rc::new(22); -rayon_core::join(|| r.clone(), || r.clone()); +rustc_thred_pool::join(|| r.clone(), || r.clone()); //~^ ERROR ``` */ diff --git a/compiler/rustc_thread_pool/src/compile_fail/scope_join_bad.rs b/compiler/rustc_thread_pool/src/compile_fail/scope_join_bad.rs index 75e4c5ca6c0..6e700a483b1 100644 --- a/compiler/rustc_thread_pool/src/compile_fail/scope_join_bad.rs +++ b/compiler/rustc_thread_pool/src/compile_fail/scope_join_bad.rs @@ -3,7 +3,7 @@ fn bad_scope<F>(f: F) where F: FnOnce(&i32) + Send, { - rayon_core::scope(|s| { + rustc_thred_pool::scope(|s| { let x = 22; s.spawn(|_| f(&x)); //~ ERROR `x` does not live long enough }); @@ -13,7 +13,7 @@ fn good_scope<F>(f: F) where F: FnOnce(&i32) + Send, { let x = 22; - rayon_core::scope(|s| { + rustc_thred_pool::scope(|s| { s.spawn(|_| f(&x)); }); } diff --git a/compiler/rustc_thread_pool/src/join/mod.rs b/compiler/rustc_thread_pool/src/join/mod.rs index 798a8347d79..e48d17f16a3 100644 --- a/compiler/rustc_thread_pool/src/join/mod.rs +++ b/compiler/rustc_thread_pool/src/join/mod.rs @@ -41,7 +41,7 @@ mod test; /// [the `par_sort` method]: ../rayon/slice/trait.ParallelSliceMut.html#method.par_sort /// /// ```rust -/// # use rayon_core as rayon; +/// # use rustc_thred_pool as rayon; /// let mut v = vec![5, 1, 8, 22, 0, 44]; /// quick_sort(&mut v); /// assert_eq!(v, vec![0, 1, 5, 8, 22, 44]); diff --git a/compiler/rustc_thread_pool/src/lib.rs b/compiler/rustc_thread_pool/src/lib.rs index 179d63ed668..f1d466b4948 100644 --- a/compiler/rustc_thread_pool/src/lib.rs +++ b/compiler/rustc_thread_pool/src/lib.rs @@ -152,14 +152,14 @@ enum ErrorKind { /// The following creates a thread pool with 22 threads. /// /// ```rust -/// # use rayon_core as rayon; +/// # use rustc_thred_pool as rayon; /// let pool = rayon::ThreadPoolBuilder::new().num_threads(22).build().unwrap(); /// ``` /// /// To instead configure the global thread pool, use [`build_global()`]: /// /// ```rust -/// # use rayon_core as rayon; +/// # use rustc_thred_pool as rayon; /// rayon::ThreadPoolBuilder::new().num_threads(22).build_global().unwrap(); /// ``` /// @@ -315,7 +315,7 @@ impl ThreadPoolBuilder { /// A scoped pool may be useful in combination with scoped thread-local variables. /// /// ``` - /// # use rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// /// scoped_tls::scoped_thread_local!(static POOL_DATA: Vec<i32>); /// @@ -382,7 +382,7 @@ impl<S> ThreadPoolBuilder<S> { /// A minimal spawn handler just needs to call `run()` from an independent thread. /// /// ``` - /// # use rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// fn main() -> Result<(), rayon::ThreadPoolBuildError> { /// let pool = rayon::ThreadPoolBuilder::new() /// .spawn_handler(|thread| { @@ -400,7 +400,7 @@ impl<S> ThreadPoolBuilder<S> { /// any errors from the thread builder. /// /// ``` - /// # use rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// fn main() -> Result<(), rayon::ThreadPoolBuildError> { /// let pool = rayon::ThreadPoolBuilder::new() /// .spawn_handler(|thread| { @@ -429,7 +429,7 @@ impl<S> ThreadPoolBuilder<S> { /// [`std::thread::scope`]: https://doc.rust-lang.org/std/thread/fn.scope.html /// /// ``` - /// # use rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// fn main() -> Result<(), rayon::ThreadPoolBuildError> { /// std::thread::scope(|scope| { /// let pool = rayon::ThreadPoolBuilder::new() diff --git a/compiler/rustc_thread_pool/src/scope/mod.rs b/compiler/rustc_thread_pool/src/scope/mod.rs index 95a4e0b7a18..82b3d053dcb 100644 --- a/compiler/rustc_thread_pool/src/scope/mod.rs +++ b/compiler/rustc_thread_pool/src/scope/mod.rs @@ -84,7 +84,7 @@ struct ScopeBase<'scope> { /// it would be less efficient than the real implementation: /// /// ```rust -/// # use rayon_core as rayon; +/// # use rustc_thred_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 rayon_core as rayon; +/// # use rustc_thred_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 rayon_core as rayon; +/// # use rustc_thred_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 rayon_core as rayon; +/// # use rustc_thred_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 rayon_core as rayon; +/// # use rustc_thred_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 rayon_core as rayon; +/// # use rustc_thred_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 rayon_core as rayon; +/// # use rustc_thred_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 rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// let mut value_a = None; /// let mut value_b = None; /// let mut value_c = None; diff --git a/compiler/rustc_thread_pool/src/spawn/mod.rs b/compiler/rustc_thread_pool/src/spawn/mod.rs index f1679a98234..92b89ed5948 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 rayon_core as rayon; +/// # use rustc_thred_pool as rayon; /// use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; /// /// static GLOBAL_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; diff --git a/compiler/rustc_thread_pool/src/thread_pool/mod.rs b/compiler/rustc_thread_pool/src/thread_pool/mod.rs index ce8783cf0d6..c8644ecf9a9 100644 --- a/compiler/rustc_thread_pool/src/thread_pool/mod.rs +++ b/compiler/rustc_thread_pool/src/thread_pool/mod.rs @@ -28,7 +28,7 @@ mod test; /// ## Creating a ThreadPool /// /// ```rust -/// # use rayon_core as rayon; +/// # use rustc_thred_pool as rayon; /// let pool = rayon::ThreadPoolBuilder::new().num_threads(8).build().unwrap(); /// ``` /// @@ -88,10 +88,10 @@ impl ThreadPool { /// meantime. For example /// /// ```rust - /// # use rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// fn main() { /// rayon::ThreadPoolBuilder::new().num_threads(1).build_global().unwrap(); - /// let pool = rayon_core::ThreadPoolBuilder::default().build().unwrap(); + /// let pool = rustc_thred_pool::ThreadPoolBuilder::default().build().unwrap(); /// let do_it = || { /// print!("one "); /// pool.install(||{}); @@ -123,7 +123,7 @@ impl ThreadPool { /// ## Using `install()` /// /// ```rust - /// # use rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// fn main() { /// let pool = rayon::ThreadPoolBuilder::new().num_threads(8).build().unwrap(); /// let n = pool.install(|| fib(20)); @@ -172,7 +172,7 @@ impl ThreadPool { /// # Examples /// /// ``` - /// # use rayon_core as rayon; + /// # use rustc_thred_pool as rayon; /// use std::sync::atomic::{AtomicUsize, Ordering}; /// /// fn main() { diff --git a/compiler/rustc_thread_pool/tests/double_init_fail.rs b/compiler/rustc_thread_pool/tests/double_init_fail.rs index 71ed425bb32..ef190099293 100644 --- a/compiler/rustc_thread_pool/tests/double_init_fail.rs +++ b/compiler/rustc_thread_pool/tests/double_init_fail.rs @@ -1,6 +1,6 @@ use std::error::Error; -use rayon_core::ThreadPoolBuilder; +use rustc_thred_pool::ThreadPoolBuilder; #[test] #[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] diff --git a/compiler/rustc_thread_pool/tests/init_zero_threads.rs b/compiler/rustc_thread_pool/tests/init_zero_threads.rs index c1770e57f3c..1f7e299e3e9 100644 --- a/compiler/rustc_thread_pool/tests/init_zero_threads.rs +++ b/compiler/rustc_thread_pool/tests/init_zero_threads.rs @@ -1,4 +1,4 @@ -use rayon_core::ThreadPoolBuilder; +use rustc_thred_pool::ThreadPoolBuilder; #[test] #[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)] diff --git a/compiler/rustc_thread_pool/tests/scope_join.rs b/compiler/rustc_thread_pool/tests/scope_join.rs index 9d88133bc5b..0bd33d086cf 100644 --- a/compiler/rustc_thread_pool/tests/scope_join.rs +++ b/compiler/rustc_thread_pool/tests/scope_join.rs @@ -4,7 +4,7 @@ where F: FnOnce() + Send, G: FnOnce() + Send, { - rayon_core::scope(|s| { + rustc_thred_pool::scope(|s| { s.spawn(|_| g()); f(); }); diff --git a/compiler/rustc_thread_pool/tests/scoped_threadpool.rs b/compiler/rustc_thread_pool/tests/scoped_threadpool.rs index 8cc2c859c0c..e4b0f6c41e1 100644 --- a/compiler/rustc_thread_pool/tests/scoped_threadpool.rs +++ b/compiler/rustc_thread_pool/tests/scoped_threadpool.rs @@ -1,5 +1,5 @@ use crossbeam_utils::thread; -use rayon_core::ThreadPoolBuilder; +use rustc_thred_pool::ThreadPoolBuilder; #[derive(PartialEq, Eq, Debug)] struct Local(i32); diff --git a/compiler/rustc_thread_pool/tests/simple_panic.rs b/compiler/rustc_thread_pool/tests/simple_panic.rs index 2564482a47e..16896e36fa0 100644 --- a/compiler/rustc_thread_pool/tests/simple_panic.rs +++ b/compiler/rustc_thread_pool/tests/simple_panic.rs @@ -1,4 +1,4 @@ -use rayon_core::join; +use rustc_thred_pool::join; #[test] #[should_panic(expected = "should panic")] diff --git a/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs b/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs index c7a880de8bb..49c9ca1d75e 100644 --- a/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs +++ b/compiler/rustc_thread_pool/tests/stack_overflow_crash.rs @@ -3,7 +3,7 @@ use std::env; use std::os::unix::process::ExitStatusExt; use std::process::{Command, ExitStatus, Stdio}; -use rayon_core::ThreadPoolBuilder; +use rustc_thred_pool::ThreadPoolBuilder; fn force_stack_overflow(depth: u32) { let mut buffer = [0u8; 1024 * 1024]; |
