about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCelina G. Val <celinval@amazon.com>2025-06-11 11:45:06 -0700
committerCelina G. Val <celinval@amazon.com>2025-06-11 12:26:42 -0700
commit4aa62ea9e9015621969a0f505abf7a6894e99e9e (patch)
tree0fee7d64957aef4f6634319edc073b4557f747f0
parent0b9b1df0064396708a5e5ca27fd010ae3ad3a305 (diff)
downloadrust-4aa62ea9e9015621969a0f505abf7a6894e99e9e.tar.gz
rust-4aa62ea9e9015621969a0f505abf7a6894e99e9e.zip
Use `rustc_thread_pool` instead of `rustc-rayon-core`
-rw-r--r--Cargo.lock39
-rw-r--r--compiler/rustc_data_structures/Cargo.toml2
-rw-r--r--compiler/rustc_data_structures/src/sync.rs2
-rw-r--r--compiler/rustc_data_structures/src/sync/parallel.rs12
-rw-r--r--compiler/rustc_interface/Cargo.toml2
-rw-r--r--compiler/rustc_interface/src/util.rs8
-rw-r--r--compiler/rustc_middle/Cargo.toml2
-rw-r--r--compiler/rustc_middle/src/ty/context/tls.rs2
-rw-r--r--compiler/rustc_query_system/Cargo.toml2
-rw-r--r--compiler/rustc_query_system/src/query/job.rs10
-rw-r--r--compiler/rustc_thread_pool/Cargo.toml14
-rw-r--r--compiler/rustc_thread_pool/src/compile_fail/quicksort_race1.rs2
-rw-r--r--compiler/rustc_thread_pool/src/compile_fail/quicksort_race2.rs2
-rw-r--r--compiler/rustc_thread_pool/src/compile_fail/quicksort_race3.rs2
-rw-r--r--compiler/rustc_thread_pool/src/compile_fail/rc_return.rs4
-rw-r--r--compiler/rustc_thread_pool/src/compile_fail/rc_upvar.rs2
-rw-r--r--compiler/rustc_thread_pool/src/compile_fail/scope_join_bad.rs4
-rw-r--r--compiler/rustc_thread_pool/src/join/mod.rs2
-rw-r--r--compiler/rustc_thread_pool/src/lib.rs12
-rw-r--r--compiler/rustc_thread_pool/src/scope/mod.rs16
-rw-r--r--compiler/rustc_thread_pool/src/spawn/mod.rs2
-rw-r--r--compiler/rustc_thread_pool/src/thread_pool/mod.rs10
-rw-r--r--compiler/rustc_thread_pool/tests/double_init_fail.rs2
-rw-r--r--compiler/rustc_thread_pool/tests/init_zero_threads.rs2
-rw-r--r--compiler/rustc_thread_pool/tests/scope_join.rs2
-rw-r--r--compiler/rustc_thread_pool/tests/scoped_threadpool.rs2
-rw-r--r--compiler/rustc_thread_pool/tests/simple_panic.rs2
-rw-r--r--compiler/rustc_thread_pool/tests/stack_overflow_crash.rs2
-rw-r--r--src/tools/tidy/src/deps.rs2
29 files changed, 86 insertions, 81 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 93abab8469a..ba3a10bad95 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2978,6 +2978,15 @@ dependencies = [
 ]
 
 [[package]]
+name = "rand_xorshift"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a"
+dependencies = [
+ "rand_core 0.9.3",
+]
+
+[[package]]
 name = "rand_xoshiro"
 version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3177,16 +3186,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "rustc-rayon-core"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f42932dcd3bcbe484b38a3ccf79b7906fac41c02d408b5b1bac26da3416efdb"
-dependencies = [
- "crossbeam-deque",
- "crossbeam-utils",
-]
-
-[[package]]
 name = "rustc-semver"
 version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3554,7 +3553,6 @@ dependencies = [
  "parking_lot",
  "portable-atomic",
  "rustc-hash 2.1.1",
- "rustc-rayon-core",
  "rustc-stable-hash",
  "rustc_arena",
  "rustc_graphviz",
@@ -3562,6 +3560,7 @@ dependencies = [
  "rustc_index",
  "rustc_macros",
  "rustc_serialize",
+ "rustc_thread_pool",
  "smallvec",
  "stacker",
  "tempfile",
@@ -3908,7 +3907,6 @@ dependencies = [
 name = "rustc_interface"
 version = "0.0.0"
 dependencies = [
- "rustc-rayon-core",
  "rustc_abi",
  "rustc_ast",
  "rustc_ast_lowering",
@@ -3947,6 +3945,7 @@ dependencies = [
  "rustc_span",
  "rustc_symbol_mangling",
  "rustc_target",
+ "rustc_thread_pool",
  "rustc_trait_selection",
  "rustc_traits",
  "rustc_ty_utils",
@@ -4074,7 +4073,6 @@ dependencies = [
  "either",
  "gsgdt",
  "polonius-engine",
- "rustc-rayon-core",
  "rustc_abi",
  "rustc_apfloat",
  "rustc_arena",
@@ -4098,6 +4096,7 @@ dependencies = [
  "rustc_session",
  "rustc_span",
  "rustc_target",
+ "rustc_thread_pool",
  "rustc_type_ir",
  "smallvec",
  "thin-vec",
@@ -4344,7 +4343,6 @@ version = "0.0.0"
 dependencies = [
  "hashbrown",
  "parking_lot",
- "rustc-rayon-core",
  "rustc_abi",
  "rustc_ast",
  "rustc_attr_data_structures",
@@ -4359,6 +4357,7 @@ dependencies = [
  "rustc_serialize",
  "rustc_session",
  "rustc_span",
+ "rustc_thread_pool",
  "smallvec",
  "tracing",
 ]
@@ -4521,6 +4520,18 @@ dependencies = [
 ]
 
 [[package]]
+name = "rustc_thread_pool"
+version = "0.0.0"
+dependencies = [
+ "crossbeam-deque",
+ "crossbeam-utils",
+ "libc",
+ "rand 0.9.1",
+ "rand_xorshift",
+ "scoped-tls",
+]
+
+[[package]]
 name = "rustc_tools_util"
 version = "0.4.2"
 
diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml
index f6a02011618..17204883fb0 100644
--- a/compiler/rustc_data_structures/Cargo.toml
+++ b/compiler/rustc_data_structures/Cargo.toml
@@ -14,7 +14,6 @@ indexmap = "2.4.0"
 jobserver_crate = { version = "0.1.28", package = "jobserver" }
 measureme = "12.0.1"
 rustc-hash = "2.0.0"
-rustc-rayon-core = { version = "0.5.0" }
 rustc-stable-hash = { version = "0.1.0", features = ["nightly"] }
 rustc_arena = { path = "../rustc_arena" }
 rustc_graphviz = { path = "../rustc_graphviz" }
@@ -22,6 +21,7 @@ rustc_hashes = { path = "../rustc_hashes" }
 rustc_index = { path = "../rustc_index", package = "rustc_index" }
 rustc_macros = { path = "../rustc_macros" }
 rustc_serialize = { path = "../rustc_serialize" }
+rustc_thread_pool = { path = "../rustc_thread_pool" }
 smallvec = { version = "1.8.1", features = ["const_generics", "union", "may_dangle"] }
 stacker = "0.1.17"
 tempfile = "3.2"
diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs
index b28c333d860..68527dde1f3 100644
--- a/compiler/rustc_data_structures/src/sync.rs
+++ b/compiler/rustc_data_structures/src/sync.rs
@@ -23,7 +23,7 @@
 //! | `RwLock<T>`             | `RefCell<T>`        | `parking_lot::RwLock<T>`        |
 //! | `MTLock<T>`        [^1] | `T`                 | `Lock<T>`                       |
 //! |                         |                     |                                 |
-//! | `ParallelIterator`      | `Iterator`          | `rayon::iter::ParallelIterator` |
+//! | `ParallelIterator`      | `Iterator`          | `rustc_thread_pool::iter::ParallelIterator` |
 //!
 //! [^1]: `MTLock` is similar to `Lock`, but the serial version avoids the cost
 //! of a `RefCell`. This is appropriate when interior mutability is not
diff --git a/compiler/rustc_data_structures/src/sync/parallel.rs b/compiler/rustc_data_structures/src/sync/parallel.rs
index ab65c7f3a6b..ff4b60a1031 100644
--- a/compiler/rustc_data_structures/src/sync/parallel.rs
+++ b/compiler/rustc_data_structures/src/sync/parallel.rs
@@ -96,7 +96,7 @@ macro_rules! parallel {
 pub fn spawn(func: impl FnOnce() + DynSend + 'static) {
     if mode::is_dyn_thread_safe() {
         let func = FromDyn::from(func);
-        rayon_core::spawn(|| {
+        rustc_thread_pool::spawn(|| {
             (func.into_inner())();
         });
     } else {
@@ -107,11 +107,11 @@ pub fn spawn(func: impl FnOnce() + DynSend + 'static) {
 // This function only works when `mode::is_dyn_thread_safe()`.
 pub fn scope<'scope, OP, R>(op: OP) -> R
 where
-    OP: FnOnce(&rayon_core::Scope<'scope>) -> R + DynSend,
+    OP: FnOnce(&rustc_thread_pool::Scope<'scope>) -> R + DynSend,
     R: DynSend,
 {
     let op = FromDyn::from(op);
-    rayon_core::scope(|s| FromDyn::from(op.into_inner()(s))).into_inner()
+    rustc_thread_pool::scope(|s| FromDyn::from(op.into_inner()(s))).into_inner()
 }
 
 #[inline]
@@ -124,7 +124,7 @@ where
         let oper_a = FromDyn::from(oper_a);
         let oper_b = FromDyn::from(oper_b);
         let (a, b) = parallel_guard(|guard| {
-            rayon_core::join(
+            rustc_thread_pool::join(
                 move || guard.run(move || FromDyn::from(oper_a.into_inner()())),
                 move || guard.run(move || FromDyn::from(oper_b.into_inner()())),
             )
@@ -158,7 +158,7 @@ fn par_slice<I: DynSend>(
             let (left, right) = items.split_at_mut(items.len() / 2);
             let mut left = state.for_each.derive(left);
             let mut right = state.for_each.derive(right);
-            rayon_core::join(move || par_rec(*left, state), move || par_rec(*right, state));
+            rustc_thread_pool::join(move || par_rec(*left, state), move || par_rec(*right, state));
         }
     }
 
@@ -241,7 +241,7 @@ pub fn par_map<I: DynSend, T: IntoIterator<Item = I>, R: DynSend, C: FromIterato
 pub fn broadcast<R: DynSend>(op: impl Fn(usize) -> R + DynSync) -> Vec<R> {
     if mode::is_dyn_thread_safe() {
         let op = FromDyn::from(op);
-        let results = rayon_core::broadcast(|context| op.derive(op(context.index())));
+        let results = rustc_thread_pool::broadcast(|context| op.derive(op(context.index())));
         results.into_iter().map(|r| r.into_inner()).collect()
     } else {
         vec![op(0)]
diff --git a/compiler/rustc_interface/Cargo.toml b/compiler/rustc_interface/Cargo.toml
index ff28dbeaee6..a72a7958787 100644
--- a/compiler/rustc_interface/Cargo.toml
+++ b/compiler/rustc_interface/Cargo.toml
@@ -5,7 +5,6 @@ edition = "2024"
 
 [dependencies]
 # tidy-alphabetical-start
-rustc-rayon-core = { version = "0.5.0" }
 rustc_ast = { path = "../rustc_ast" }
 rustc_ast_lowering = { path = "../rustc_ast_lowering" }
 rustc_ast_passes = { path = "../rustc_ast_passes" }
@@ -43,6 +42,7 @@ rustc_session = { path = "../rustc_session" }
 rustc_span = { path = "../rustc_span" }
 rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
 rustc_target = { path = "../rustc_target" }
+rustc_thread_pool = { path = "../rustc_thread_pool" }
 rustc_trait_selection = { path = "../rustc_trait_selection" }
 rustc_traits = { path = "../rustc_traits" }
 rustc_ty_utils = { path = "../rustc_ty_utils" }
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index 8bdc24d47d9..8a7d6117265 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -208,7 +208,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
 
     let proxy_ = Arc::clone(&proxy);
     let proxy__ = Arc::clone(&proxy);
-    let builder = rayon_core::ThreadPoolBuilder::new()
+    let builder = rustc_thread_pool::ThreadPoolBuilder::new()
         .thread_name(|_| "rustc".to_string())
         .acquire_thread_handler(move || proxy_.acquire_thread())
         .release_thread_handler(move || proxy__.release_thread())
@@ -218,7 +218,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
             // locals to it. The new thread runs the deadlock handler.
 
             let current_gcx2 = current_gcx2.clone();
-            let registry = rayon_core::Registry::current();
+            let registry = rustc_thread_pool::Registry::current();
             let session_globals = rustc_span::with_session_globals(|session_globals| {
                 session_globals as *const SessionGlobals as usize
             });
@@ -265,7 +265,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
             builder
                 .build_scoped(
                     // Initialize each new worker thread when created.
-                    move |thread: rayon_core::ThreadBuilder| {
+                    move |thread: rustc_thread_pool::ThreadBuilder| {
                         // Register the thread for use with the `WorkerLocal` type.
                         registry.register();
 
@@ -274,7 +274,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
                         })
                     },
                     // Run `f` on the first thread in the thread pool.
-                    move |pool: &rayon_core::ThreadPool| {
+                    move |pool: &rustc_thread_pool::ThreadPool| {
                         pool.install(|| f(current_gcx.into_inner(), proxy))
                     },
                 )
diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml
index 43c1af642dd..edd0af6e4f5 100644
--- a/compiler/rustc_middle/Cargo.toml
+++ b/compiler/rustc_middle/Cargo.toml
@@ -9,7 +9,6 @@ bitflags = "2.4.1"
 either = "1.5.0"
 gsgdt = "0.1.2"
 polonius-engine = "0.13.0"
-rustc-rayon-core = { version = "0.5.0" }
 rustc_abi = { path = "../rustc_abi" }
 rustc_apfloat = "0.2.0"
 rustc_arena = { path = "../rustc_arena" }
@@ -33,6 +32,7 @@ rustc_serialize = { path = "../rustc_serialize" }
 rustc_session = { path = "../rustc_session" }
 rustc_span = { path = "../rustc_span" }
 rustc_target = { path = "../rustc_target" }
+rustc_thread_pool = { path = "../rustc_thread_pool" }
 rustc_type_ir = { path = "../rustc_type_ir" }
 smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
 thin-vec = "0.2.12"
diff --git a/compiler/rustc_middle/src/ty/context/tls.rs b/compiler/rustc_middle/src/ty/context/tls.rs
index 5fc80bc7936..fa9995898ac 100644
--- a/compiler/rustc_middle/src/ty/context/tls.rs
+++ b/compiler/rustc_middle/src/ty/context/tls.rs
@@ -36,7 +36,7 @@ impl<'a, 'tcx> ImplicitCtxt<'a, 'tcx> {
 }
 
 // Import the thread-local variable from Rayon, which is preserved for Rayon jobs.
-use rayon_core::tlv::TLV;
+use rustc_thread_pool::tlv::TLV;
 
 #[inline]
 fn erase(context: &ImplicitCtxt<'_, '_>) -> *const () {
diff --git a/compiler/rustc_query_system/Cargo.toml b/compiler/rustc_query_system/Cargo.toml
index 7db06953aeb..3d2d879a764 100644
--- a/compiler/rustc_query_system/Cargo.toml
+++ b/compiler/rustc_query_system/Cargo.toml
@@ -6,7 +6,6 @@ edition = "2024"
 [dependencies]
 # tidy-alphabetical-start
 parking_lot = "0.12"
-rustc-rayon-core = { version = "0.5.0" }
 rustc_abi = { path = "../rustc_abi" }
 rustc_ast = { path = "../rustc_ast" }
 rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
@@ -21,6 +20,7 @@ rustc_macros = { path = "../rustc_macros" }
 rustc_serialize = { path = "../rustc_serialize" }
 rustc_session = { path = "../rustc_session" }
 rustc_span = { path = "../rustc_span" }
+rustc_thread_pool = { path = "../rustc_thread_pool" }
 smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
 tracing = "0.1"
 # tidy-alphabetical-end
diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs
index 1e79bd461d2..7e61f5026da 100644
--- a/compiler/rustc_query_system/src/query/job.rs
+++ b/compiler/rustc_query_system/src/query/job.rs
@@ -236,7 +236,7 @@ impl<I> QueryLatch<I> {
             // If this detects a deadlock and the deadlock handler wants to resume this thread
             // we have to be in the `wait` call. This is ensured by the deadlock handler
             // getting the self.info lock.
-            rayon_core::mark_blocked();
+            rustc_thread_pool::mark_blocked();
             let proxy = qcx.jobserver_proxy();
             proxy.release_thread();
             waiter.condvar.wait(&mut info);
@@ -251,9 +251,9 @@ impl<I> QueryLatch<I> {
         let mut info = self.info.lock();
         debug_assert!(!info.complete);
         info.complete = true;
-        let registry = rayon_core::Registry::current();
+        let registry = rustc_thread_pool::Registry::current();
         for waiter in info.waiters.drain(..) {
-            rayon_core::mark_unblocked(&registry);
+            rustc_thread_pool::mark_unblocked(&registry);
             waiter.condvar.notify_one();
         }
     }
@@ -507,7 +507,7 @@ fn remove_cycle<I: Clone>(
 /// all active queries for cycles before finally resuming all the waiters at once.
 pub fn break_query_cycles<I: Clone + Debug>(
     query_map: QueryMap<I>,
-    registry: &rayon_core::Registry,
+    registry: &rustc_thread_pool::Registry,
 ) {
     let mut wakelist = Vec::new();
     // It is OK per the comments:
@@ -543,7 +543,7 @@ pub fn break_query_cycles<I: Clone + Debug>(
     // we wake the threads up as otherwise Rayon could detect a deadlock if a thread we
     // resumed fell asleep and this thread had yet to mark the remaining threads as unblocked.
     for _ in 0..wakelist.len() {
-        rayon_core::mark_unblocked(registry);
+        rustc_thread_pool::mark_unblocked(registry);
     }
 
     for waiter in wakelist.into_iter() {
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];
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index fdca7a7a40e..7cdfe79a40b 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -356,6 +356,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
     "rand",
     "rand_chacha",
     "rand_core",
+    "rand_xorshift", // dependency for doc-tests in rustc_thread_pool
     "rand_xoshiro",
     "redox_syscall",
     "regex",
@@ -364,7 +365,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
     "rustc-demangle",
     "rustc-hash",
     "rustc-literal-escaper",
-    "rustc-rayon-core",
     "rustc-stable-hash",
     "rustc_apfloat",
     "rustix",