Set CFG_RELEASE for tools in bootstrap/tool.rs

Since rustc-ap-* v659 we now need to set CFG_RELEASE for
rustc-ap-rustc_attr for `#[cfg(version(...))]` to work.

Co-authored-by: Eric Huss <ehuss@users.noreply.github.com>
This commit is contained in:
Igor Matuszewski 2020-05-28 10:44:01 +02:00 committed by flip1995
parent 84eae777c1
commit 489b7e4123
No known key found for this signature in database
GPG Key ID: 2CEFCDB27ED0BE79

View File

@ -252,6 +252,10 @@ pub fn prepare_tool_cargo(
// own copy
cargo.env("LZMA_API_STATIC", "1");
// CFG_RELEASE is needed by rustfmt (and possibly other tools) which
// import rustc-ap-rustc_attr which requires this to be set for the
// `#[cfg(version(...))]` attribute.
cargo.env("CFG_RELEASE", builder.rust_release());
cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel);
cargo.env("CFG_VERSION", builder.rust_version());
cargo.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM);