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

Make #[cfg(bootstrap)] not error in proc macros on later stages #98147

Merged
merged 1 commit into from
Jun 16, 2022
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
12 changes: 9 additions & 3 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,18 @@ fn main() {
}
}

// Cargo doesn't pass RUSTFLAGS to proc_macros:
// https://github.com/rust-lang/cargo/issues/4423
// Thus, if we are on stage 0, we explicitly set `--cfg=bootstrap`.
// We also declare that the flag is expected, which is mainly needed for
// later stages so that they don't warn about #[cfg(bootstrap)],
// but enabling it for stage 0 too lets any warnings, if they occur,
// occur more early on, e.g. about #[cfg(bootstrap = "foo")].
if stage == "0" {
// Cargo doesn't pass RUSTFLAGS to proc_macros:
// https://github.com/rust-lang/cargo/issues/4423
// Set `--cfg=bootstrap` explicitly instead.
cmd.arg("--cfg=bootstrap");
}
cmd.arg("-Zunstable-options");
Copy link
Member

Choose a reason for hiding this comment

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

Still sad about the blanket enable of unstable-options being required, but ultimately it's probably OK.

cmd.arg("--check-cfg=values(bootstrap)");
}

if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") {
Expand Down