Skip to content

Commit 25102cc

Browse files
committed
Allow RUSTFMT_BOOTSTRAP=1 to override nightly feature checks.
This was recommended in rust-lang/rust#65939 (comment).
1 parent 1dffeea commit 25102cc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/release_channel.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
/// If we're being built by cargo (e.g., `cargo +nightly install rustfmt-nightly`),
99
/// `CFG_RELEASE_CHANNEL` is not set. As we only support being built against the
1010
/// nightly compiler when installed from crates.io, default to nightly mode.
11+
///
12+
/// Additionally, the RUSTFMT_BOOTSTRAP environment variable can be set to `1` to
13+
/// allow for use of unstable features when used within the compiler's stage0.
1114
pub fn is_nightly() -> bool {
1215
option_env!("CFG_RELEASE_CHANNEL").map_or(true, |c| c == "nightly" || c == "dev")
16+
|| std::env::var("RUSTFMT_BOOTSTRAP") == Ok("1".to_string())
1317
}

0 commit comments

Comments
 (0)