diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 2e01ec9b0a7..e7dd19d761e 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1583,10 +1583,7 @@ pub mod nightly_options { } pub fn is_nightly_build() -> bool { - match get_unstable_features_setting() { - UnstableFeatures::Allow | UnstableFeatures::Cheat => true, - _ => false, - } + UnstableFeatures::from_environment().is_nightly_build() } pub fn check_nightly_options(matches: &getopts::Matches, flags: &[RustcOptGroup]) { diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 2b4f03bd4f6..f8b7ad33465 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1312,6 +1312,13 @@ impl UnstableFeatures { (false, _, _) => UnstableFeatures::Allow } } + + pub fn is_nightly_build(&self) -> bool { + match *self { + UnstableFeatures::Allow | UnstableFeatures::Cheat => true, + _ => false, + } + } } fn maybe_stage_features(span_handler: &Handler, krate: &ast::Crate,