Skip to content

Commit deb4572

Browse files
committedOct 29, 2021
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]: #90227 (comment) 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`
2 parents 9ed5b94 + 581dc75 commit deb4572

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed
 

‎Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -4615,8 +4615,8 @@ dependencies = [
46154615
"itertools 0.9.0",
46164616
"minifier",
46174617
"pulldown-cmark 0.8.0",
4618+
"rayon",
46184619
"regex",
4619-
"rustc-rayon",
46204620
"rustdoc-json-types",
46214621
"serde",
46224622
"serde_json",

‎src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ path = "lib.rs"
1010
arrayvec = { version = "0.7", default-features = false }
1111
pulldown-cmark = { version = "0.8", default-features = false }
1212
minifier = "0.0.41"
13-
rayon = { version = "0.3.0", package = "rustc-rayon" }
13+
rayon = "1.3.1"
1414
serde = { version = "1.0", features = ["derive"] }
1515
serde_json = "1.0"
1616
smallvec = "1.6.1"

‎src/librustdoc/docfs.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ use std::path::{Path, PathBuf};
1515
use std::string::ToString;
1616
use std::sync::mpsc::Sender;
1717

18-
macro_rules! try_err {
19-
($e:expr, $file:expr) => {
20-
match $e {
21-
Ok(e) => e,
22-
Err(e) => return Err(E::new(e, $file)),
23-
}
24-
};
25-
}
26-
2718
crate trait PathError {
2819
fn new<S, P: AsRef<Path>>(e: S, path: P) -> Self
2920
where
@@ -75,7 +66,7 @@ impl DocFS {
7566
});
7667
});
7768
} else {
78-
try_err!(fs::write(&path, contents), path);
69+
fs::write(&path, contents).map_err(|e| E::new(e, path))?;
7970
}
8071
Ok(())
8172
}

0 commit comments

Comments
 (0)
Please sign in to comment.