about summary refs log tree commit diff
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2022-05-06 07:56:53 +0300
committerklensy <klensy@users.noreply.github.com>2022-05-06 07:56:53 +0300
commit7f1174977f39087b9d00ca0c185876876d202579 (patch)
tree5e16f7df4e50899c235211f5bc6bb948785bad15
parent74cea9fdb9ca77d4104df5c28124817004ead6a3 (diff)
downloadrust-7f1174977f39087b9d00ca0c185876876d202579.tar.gz
rust-7f1174977f39087b9d00ca0c185876876d202579.zip
rustdoc: don't build `rayon` for non-windows targets
-rw-r--r--src/librustdoc/Cargo.toml4
-rw-r--r--src/librustdoc/docfs.rs7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml
index 21efd040663..0495cd97dc2 100644
--- a/src/librustdoc/Cargo.toml
+++ b/src/librustdoc/Cargo.toml
@@ -12,7 +12,6 @@ askama = { version = "0.11", default-features = false, features = ["config"] }
 atty = "0.2"
 pulldown-cmark = { version = "0.9", default-features = false }
 minifier = "0.0.43"
-rayon = "1.5.1"
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
 smallvec = "1.6.1"
@@ -29,6 +28,9 @@ version = "0.3.3"
 default-features = false
 features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"]
 
+[target.'cfg(windows)'.dependencies]
+rayon = "1.5.1"
+
 [dev-dependencies]
 expect-test = "1.0"
 
diff --git a/src/librustdoc/docfs.rs b/src/librustdoc/docfs.rs
index d59273db08b..8dd8eb23df2 100644
--- a/src/librustdoc/docfs.rs
+++ b/src/librustdoc/docfs.rs
@@ -54,7 +54,8 @@ impl DocFS {
     where
         E: PathError,
     {
-        if !self.sync_only && cfg!(windows) {
+        #[cfg(windows)]
+        if !self.sync_only {
             // A possible future enhancement after more detailed profiling would
             // be to create the file sync so errors are reported eagerly.
             let sender = self.errors.clone().expect("can't write after closing");
@@ -68,6 +69,10 @@ impl DocFS {
         } else {
             fs::write(&path, contents).map_err(|e| E::new(e, path))?;
         }
+
+        #[cfg(not(windows))]
+        fs::write(&path, contents).map_err(|e| E::new(e, path))?;
+
         Ok(())
     }
 }