Skip to content

Commit 85a9cfa

Browse files
committed
Deal with spaces in the rust version.
1 parent 73b7a04 commit 85a9cfa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/bootstrap/builder.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,11 @@ impl<'a> Builder<'a> {
12701270
}
12711271

12721272
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
1273-
rustdocflags.arg("--crate-version").arg(&self.rust_version());
1273+
// This replaces spaces with newlines because RUSTDOCFLAGS does not
1274+
// support arguments with regular spaces. Hopefully someday Cargo will
1275+
// have space support.
1276+
let rust_version = self.rust_version().replace(' ', "\n");
1277+
rustdocflags.arg("--crate-version").arg(&rust_version);
12741278

12751279
// Environment variables *required* throughout the build
12761280
//
@@ -1447,14 +1451,14 @@ impl Rustflags {
14471451

14481452
fn env(&mut self, env: &str) {
14491453
if let Ok(s) = env::var(env) {
1450-
for part in s.split_whitespace() {
1454+
for part in s.split(' ') {
14511455
self.arg(part);
14521456
}
14531457
}
14541458
}
14551459

14561460
fn arg(&mut self, arg: &str) -> &mut Self {
1457-
assert_eq!(arg.split_whitespace().count(), 1);
1461+
assert_eq!(arg.split(' ').count(), 1);
14581462
if !self.0.is_empty() {
14591463
self.0.push_str(" ");
14601464
}

0 commit comments

Comments
 (0)