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

Fix rustc-args passing issue in bootstrap #113948

Merged
merged 1 commit into from
Jul 22, 2023
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
7 changes: 7 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2043,6 +2043,13 @@ impl<'a> Builder<'a> {
rustflags.arg("-Zinline-mir");
}

// set rustc args passed from command line
let rustc_args =
self.config.cmd.rustc_args().iter().map(|s| s.to_string()).collect::<Vec<_>>();
if !rustc_args.is_empty() {
cargo.env("RUSTFLAGS", &rustc_args.join(" "));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this patch, it doesn't make sense to me. This is setting the RUSTFLAGS env var, but when this Cargo instance is later turned into a Command, the RUSTFLAGS env var is anyway overwritten again:

fn from(mut cargo: Cargo) -> Command {
let rustflags = &cargo.rustflags.0;
if !rustflags.is_empty() {
cargo.command.env("RUSTFLAGS", rustflags);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be added to rustflags instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the --help text says this should only be passed when running tests; I don't see that reflected in the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this isn't correct and fixed in #123489.


Cargo { command: cargo, rustflags, rustdocflags, allow_features }
}

Expand Down