Skip to content

Commit

Permalink
Deal with spaces in the rust version.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Aug 15, 2020
1 parent 73b7a04 commit 85a9cfa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/bootstrap/builder.rs
Expand Up @@ -1270,7 +1270,11 @@ impl<'a> Builder<'a> {
}

// 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
//
Expand Down Expand Up @@ -1447,14 +1451,14 @@ impl 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(" ");
}
Expand Down

0 comments on commit 85a9cfa

Please sign in to comment.