about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-10-29 15:31:37 +0000
committerbors <bors@rust-lang.org>2021-10-29 15:31:37 +0000
commitdeb45729231561effe503e8be0d0e62ec01a8c1d (patch)
tree18748612971c3df65f37b128596e4c4ffb65b1e7
parent9ed5b94b28e758996db395d472e0345d0ffe612d (diff)
parent581dc7588808e9df11de199ffaddc0f3157720c3 (diff)
downloadrust-deb45729231561effe503e8be0d0e62ec01a8c1d.tar.gz
rust-deb45729231561effe503e8be0d0e62ec01a8c1d.zip
Auto merge of #90389 - camelid:rustdoc-rayon, r=jyn514
rustdoc: Switch to mainline rayon

The rustc fork of rayon integrates with Cargo's jobserver to limit the
amount of parallelism. However, rustdoc's use case is concurrent I/O,
which is not CPU-heavy, so it should be able to use mainline rayon.

See [this discussion][1] for more details.

[1]: https://github.com/rust-lang/rust/issues/90227#issuecomment-952468618

Note: I chose rayon 1.3.1 so that the rayon version used elsewhere in
the workspace does not change.

r? `@Mark-Simulacrum`
cc `@jyn514`
-rw-r--r--Cargo.lock2
-rw-r--r--src/librustdoc/Cargo.toml2
-rw-r--r--src/librustdoc/docfs.rs11
3 files changed, 3 insertions, 12 deletions
diff --git a/Cargo.lock b/Cargo.lock
index bf19f5e0ae3..0ffc5bdd237 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4615,8 +4615,8 @@ dependencies = [
  "itertools 0.9.0",
  "minifier",
  "pulldown-cmark 0.8.0",
+ "rayon",
  "regex",
- "rustc-rayon",
  "rustdoc-json-types",
  "serde",
  "serde_json",
diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml
index 945b2a8e9a8..268905bcb53 100644
--- a/src/librustdoc/Cargo.toml
+++ b/src/librustdoc/Cargo.toml
@@ -10,7 +10,7 @@ path = "lib.rs"
 arrayvec = { version = "0.7", default-features = false }
 pulldown-cmark = { version = "0.8", default-features = false }
 minifier = "0.0.41"
-rayon = { version = "0.3.0", package = "rustc-rayon" }
+rayon = "1.3.1"
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
 smallvec = "1.6.1"
diff --git a/src/librustdoc/docfs.rs b/src/librustdoc/docfs.rs
index a5fab1b3d42..d59273db08b 100644
--- a/src/librustdoc/docfs.rs
+++ b/src/librustdoc/docfs.rs
@@ -15,15 +15,6 @@ use std::path::{Path, PathBuf};
 use std::string::ToString;
 use std::sync::mpsc::Sender;
 
-macro_rules! try_err {
-    ($e:expr, $file:expr) => {
-        match $e {
-            Ok(e) => e,
-            Err(e) => return Err(E::new(e, $file)),
-        }
-    };
-}
-
 crate trait PathError {
     fn new<S, P: AsRef<Path>>(e: S, path: P) -> Self
     where
@@ -75,7 +66,7 @@ impl DocFS {
                 });
             });
         } else {
-            try_err!(fs::write(&path, contents), path);
+            fs::write(&path, contents).map_err(|e| E::new(e, path))?;
         }
         Ok(())
     }