Skip to content

rustbuild: ensure CFG_RELEASE_CHANNEL is always defined #42696

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
// Set some configuration variables picked up by build scripts and
// the compiler alike
cargo.env("CFG_RELEASE", build.rust_release())
.env("CFG_RELEASE_CHANNEL", &build.config.channel)
.env("CFG_VERSION", build.rust_version())
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(PathBuf::new()));

Expand Down Expand Up @@ -461,8 +460,6 @@ pub fn tool(build: &Build, stage: u32, target: &str, tool: &str) {
cargo.env("LIBZ_SYS_STATIC", "1");
}

cargo.env("CFG_RELEASE_CHANNEL", &build.config.channel);

let info = GitInfo::new(&dir);
if let Some(sha) = info.sha() {
cargo.env("CFG_COMMIT_HASH", sha);
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ impl Build {
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
}

// Ensure we have access to the release channel we're building everywhere.
// This is used by cargo to compute the libraries hash.
cargo.env("CFG_RELEASE_CHANNEL", &self.config.channel);

// There are two invariants we must maintain:
// * stable crates cannot depend on unstable crates (general Rust rule),
// * crates that end up in the sysroot must be unstable (rustbuild rule).
Expand Down