diff options
| author | bors <bors@rust-lang.org> | 2020-04-25 07:26:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-04-25 07:26:17 +0000 |
| commit | a58b1ed44f5e06976de2bdc4d7dc81c36a96934f (patch) | |
| tree | 54f1164cd3503ffbd0b9dc2b5775b23609b77673 /src/bootstrap | |
| parent | 40008dcb494a00571123b7d59115068a200ebe34 (diff) | |
| parent | 08c8996ff6f152e2ac580fbabce46e97457185e3 (diff) | |
| download | rust-a58b1ed44f5e06976de2bdc4d7dc81c36a96934f.tar.gz rust-a58b1ed44f5e06976de2bdc4d7dc81c36a96934f.zip | |
Auto merge of #71458 - ecstatic-morse:bootstrap-cfg-doc, r=Mark-Simulacrum
Set `--cfg bootstrap` for stage0 rustdoc Resolves #71455. With this patch, running `./x.py doc --stage 0 src/libstd` with a clean `build` dir successfully outputs docs for `core`, `alloc` and `std` in under a minute. This kind of turnaround for viewing small changes to the standard library documentation is quite nice, and I think we should endeavour to keep it working. I'm not sure how involved that would be though. r? @Mark-Simulacrum
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/builder.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 8d6c2db7926..4a664205bff 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -791,6 +791,11 @@ impl<'a> Builder<'a> { rustflags.arg("--cfg=bootstrap"); } + // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`, + // but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See + // #71458. + let rustdocflags = rustflags.clone(); + if let Ok(s) = env::var("CARGOFLAGS") { cargo.args(s.split_whitespace()); } @@ -1269,7 +1274,7 @@ impl<'a> Builder<'a> { } } - Cargo { command: cargo, rustflags } + Cargo { command: cargo, rustflags, rustdocflags } } /// Ensure that a given step is built, returning its output. This will @@ -1327,7 +1332,7 @@ impl<'a> Builder<'a> { #[cfg(test)] mod tests; -#[derive(Debug)] +#[derive(Debug, Clone)] struct Rustflags(String); impl Rustflags { @@ -1367,6 +1372,7 @@ impl Rustflags { pub struct Cargo { command: Command, rustflags: Rustflags, + rustdocflags: Rustflags, } impl Cargo { @@ -1399,7 +1405,16 @@ impl Cargo { impl From<Cargo> for Command { fn from(mut cargo: Cargo) -> Command { - cargo.command.env("RUSTFLAGS", &cargo.rustflags.0); + let rustflags = &cargo.rustflags.0; + if !rustflags.is_empty() { + cargo.command.env("RUSTFLAGS", rustflags); + } + + let rustdocflags = &cargo.rustdocflags.0; + if !rustdocflags.is_empty() { + cargo.command.env("RUSTDOCFLAGS", rustdocflags); + } + cargo.command } } |
