]> git.lizzy.rs Git - rust.git/commitdiff
Deal with spaces in the rust version.
authorEric Huss <eric@huss.org>
Sat, 15 Aug 2020 00:52:09 +0000 (17:52 -0700)
committerEric Huss <eric@huss.org>
Sat, 15 Aug 2020 03:15:58 +0000 (20:15 -0700)
src/bootstrap/builder.rs

index 8536569919bf466dd1fd51913a5b49407e89ee4e..709b202052e577dcc6376539d2ede9cc2f42bc47 100644 (file)
@@ -1270,7 +1270,11 @@ pub fn cargo(
         }
 
         // For `cargo doc` invocations, make rustdoc print the Rust version into the docs
-        rustdocflags.arg("--crate-version").arg(&self.rust_version());
+        // This replaces spaces with newlines because RUSTDOCFLAGS does not
+        // support arguments with regular spaces. Hopefully someday Cargo will
+        // have space support.
+        let rust_version = self.rust_version().replace(' ', "\n");
+        rustdocflags.arg("--crate-version").arg(&rust_version);
 
         // Environment variables *required* throughout the build
         //
@@ -1447,14 +1451,14 @@ fn new(target: TargetSelection) -> Rustflags {
 
     fn env(&mut self, env: &str) {
         if let Ok(s) = env::var(env) {
-            for part in s.split_whitespace() {
+            for part in s.split(' ') {
                 self.arg(part);
             }
         }
     }
 
     fn arg(&mut self, arg: &str) -> &mut Self {
-        assert_eq!(arg.split_whitespace().count(), 1);
+        assert_eq!(arg.split(' ').count(), 1);
         if !self.0.is_empty() {
             self.0.push_str(" ");
         }