Skip to content

Commit

Permalink
Allow RUSTFMT_BOOTSTRAP=1 to override nightly feature checks.
Browse files Browse the repository at this point in the history
This was recommended in rust-lang/rust#65939 (comment).
  • Loading branch information
anp committed Nov 2, 2019
1 parent 1dffeea commit 25102cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/release_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
/// If we're being built by cargo (e.g., `cargo +nightly install rustfmt-nightly`),
/// `CFG_RELEASE_CHANNEL` is not set. As we only support being built against the
/// nightly compiler when installed from crates.io, default to nightly mode.
///
/// Additionally, the RUSTFMT_BOOTSTRAP environment variable can be set to `1` to
/// allow for use of unstable features when used within the compiler's stage0.
pub fn is_nightly() -> bool {
option_env!("CFG_RELEASE_CHANNEL").map_or(true, |c| c == "nightly" || c == "dev")
|| std::env::var("RUSTFMT_BOOTSTRAP") == Ok("1".to_string())
}

0 comments on commit 25102cc

Please sign in to comment.