You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
environment variable CFG_RELEASE_CHANNEL not defined #4230
Compiling rustc-ap-rustc_parse v659.0.0
error: environment variable `CFG_RELEASE_CHANNEL` not defined
--> /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_attr-659.0.0/builtin.rs:655:27
|
655 | let channel = env!("CFG_RELEASE_CHANNEL");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: environment variable `CFG_RELEASE` not defined
--> /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_attr-659.0.0/builtin.rs:657:48
|
657 | let rustc_version = Version::parse(env!("CFG_RELEASE")).unwrap();
| ^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Any ideas? I found it mentioned in #4174 but that seems to imply that it has been fixed. Am I missing something?
You're going to have to set the environment variables (CFG_RELEASE_CHANNEL and CFG_RELEASE) in order to build rustfmt from source due to recent upstream changes in the rustc tree.
Also it looks like this was never added to the docs unfortunately. Or if it was it has since been removed. :-/
Seems like CFG_RELEASE has to be an actual version now, as parsed by this code:
fn parse_str(value: &str) -> Option<Self> {
// Ignore any suffixes such as "-dev" or "-nightly".
let mut components = value.split('-').next().unwrap().splitn(3, '.');
let major = components.next()?.parse().ok()?;
let minor = components.next()?.parse().ok()?;
let patch = components.next().unwrap_or("0").parse().ok()?;
Some(RustcVersion { major, minor, patch })
}
Activity
Timmmm commentedon Jun 3, 2020
This comment suggests I need rustc version
rustc 1.45.0-nightly (d79f1bd31 2020-05-17)but I have a later one:calebcartwright commentedon Jun 3, 2020
You're going to have to set the environment variables (
CFG_RELEASE_CHANNELandCFG_RELEASE) in order to build rustfmt from source due to recent upstream changes in the rustc tree.We've updated the Contributing docs to call this out, though looks like we forgot to update the corresponding section in the readme
https://github.com/rust-lang/rustfmt/blob/master/Contributing.md#building-and-testing
Timmmm commentedon Jun 4, 2020
Ah cool, I changed the command to this:
And it compiled successfully! But then gives this error:
Any ideas?
Timmmm commentedon Jun 4, 2020
Ah I see it doesn't build anything by default. This command works perfectly - might be worth adding to the Readme?
ahl commentedon Jun 4, 2020
Should the main README.md be updated to refer to these docs? This is what it currently says:
calebcartwright commentedon Jun 5, 2020
Yes. I'm going to update this (and a few other minor items) in the docs later today
Timmmm commentedon Mar 22, 2025
Ha I just ran into this problem again and made it all the way through this thread before realising it was me from 5 years ago...
Anyway, this doesn't seem to work any more:
You get this error:
Also it looks like this was never added to the docs unfortunately. Or if it was it has since been removed. :-/
Seems like
CFG_RELEASEhas to be an actual version now, as parsed by this code:I used
1.85.0-nightlyand it worked.