File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,21 @@ use file_lines::FileLines;
2121use lists:: { ListTactic , SeparatorPlace , SeparatorTactic } ;
2222use 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.
2434macro_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
You can’t perform that action at this time.
0 commit comments