Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set --cfg bootstrap for stage0 rustdoc #71458

Merged
merged 2 commits into from
Apr 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1327,7 +1332,7 @@ impl<'a> Builder<'a> {
#[cfg(test)]
mod tests;

#[derive(Debug)]
#[derive(Debug, Clone)]
struct Rustflags(String);

impl Rustflags {
Expand Down Expand Up @@ -1367,6 +1372,7 @@ impl Rustflags {
pub struct Cargo {
command: Command,
rustflags: Rustflags,
rustdocflags: Rustflags,
}

impl Cargo {
Expand Down Expand Up @@ -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
}
}