Skip to content

Commit db5d6dd

Browse files
authored
Merge pull request #2249 from CAD97/patch-3
unstable_features without CFG_RELEASE_CHANNEL
2 parents 97fd517 + 7e2c3cb commit db5d6dd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: src/config.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,21 @@ use file_lines::FileLines;
2121
use lists::{ListTactic, SeparatorPlace, SeparatorTactic};
2222
use Summary;
2323

24+
/// Check if we're in a nightly build.
25+
///
26+
/// The environment variable `CFG_RELEASE_CHANNEL` is set during the rustc bootstrap
27+
/// to "stable", "beta", or "nightly" depending on what toolchain is being built.
28+
/// If we are being built as part of the stable or beta toolchains, we want
29+
/// to disable unstable configuration options.
30+
///
31+
/// If we're being built by cargo (e.g. `cargo +nightly install rustfmt-nightly`),
32+
/// `CFG_RELEASE_CHANNEL` is not set. As we only support being built against the
33+
/// nightly compiler when installed from crates.io, default to nightly mode.
2434
macro_rules! is_nightly_channel {
2535
() => {
2636
option_env!("CFG_RELEASE_CHANNEL")
2737
.map(|c| c == "nightly")
28-
.unwrap_or(false)
38+
.unwrap_or(true)
2939
}
3040
}
3141

0 commit comments

Comments
 (0)