@@ -37,7 +37,6 @@ use std::collections::btree_map::Iter as BTreeMapIter;
3737use std:: collections:: btree_map:: Keys as BTreeMapKeysIter ;
3838use std:: collections:: btree_map:: Values as BTreeMapValuesIter ;
3939
40- use std:: env;
4140use std:: fmt;
4241use std:: hash:: { Hasher , SipHasher } ;
4342use std:: iter:: FromIterator ;
@@ -1525,27 +1524,12 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
15251524 crate_name : crate_name,
15261525 alt_std_name : None ,
15271526 libs : libs,
1528- unstable_features : get_unstable_features_setting ( ) ,
1527+ unstable_features : UnstableFeatures :: from_environment ( ) ,
15291528 debug_assertions : debug_assertions,
15301529 } ,
15311530 cfg)
15321531}
15331532
1534- pub fn get_unstable_features_setting ( ) -> UnstableFeatures {
1535- // Whether this is a feature-staged build, i.e. on the beta or stable channel
1536- let disable_unstable_features = option_env ! ( "CFG_DISABLE_UNSTABLE_FEATURES" ) . is_some ( ) ;
1537- // The secret key needed to get through the rustc build itself by
1538- // subverting the unstable features lints
1539- let bootstrap_secret_key = option_env ! ( "CFG_BOOTSTRAP_KEY" ) ;
1540- // The matching key to the above, only known by the build system
1541- let bootstrap_provided_key = env:: var ( "RUSTC_BOOTSTRAP_KEY" ) . ok ( ) ;
1542- match ( disable_unstable_features, bootstrap_secret_key, bootstrap_provided_key) {
1543- ( _, Some ( ref s) , Some ( ref p) ) if s == p => UnstableFeatures :: Cheat ,
1544- ( true , ..) => UnstableFeatures :: Disallow ,
1545- ( false , ..) => UnstableFeatures :: Allow
1546- }
1547- }
1548-
15491533pub fn parse_crate_types_from_list ( list_list : Vec < String > ) -> Result < Vec < CrateType > , String > {
15501534 let mut crate_types: Vec < CrateType > = Vec :: new ( ) ;
15511535 for unparsed_crate_type in & list_list {
@@ -1575,26 +1559,21 @@ pub fn parse_crate_types_from_list(list_list: Vec<String>) -> Result<Vec<CrateTy
15751559pub mod nightly_options {
15761560 use getopts;
15771561 use syntax:: feature_gate:: UnstableFeatures ;
1578- use super :: { ErrorOutputType , OptionStability , RustcOptGroup , get_unstable_features_setting } ;
1562+ use super :: { ErrorOutputType , OptionStability , RustcOptGroup } ;
15791563 use session:: { early_error, early_warn} ;
15801564
15811565 pub fn is_unstable_enabled ( matches : & getopts:: Matches ) -> bool {
15821566 is_nightly_build ( ) && matches. opt_strs ( "Z" ) . iter ( ) . any ( |x| * x == "unstable-options" )
15831567 }
15841568
15851569 pub fn is_nightly_build ( ) -> bool {
1586- match get_unstable_features_setting ( ) {
1587- UnstableFeatures :: Allow | UnstableFeatures :: Cheat => true ,
1588- _ => false ,
1589- }
1570+ UnstableFeatures :: from_environment ( ) . is_nightly_build ( )
15901571 }
15911572
15921573 pub fn check_nightly_options ( matches : & getopts:: Matches , flags : & [ RustcOptGroup ] ) {
15931574 let has_z_unstable_option = matches. opt_strs ( "Z" ) . iter ( ) . any ( |x| * x == "unstable-options" ) ;
1594- let really_allows_unstable_options = match get_unstable_features_setting ( ) {
1595- UnstableFeatures :: Disallow => false ,
1596- _ => true ,
1597- } ;
1575+ let really_allows_unstable_options = UnstableFeatures :: from_environment ( )
1576+ . is_nightly_build ( ) ;
15981577
15991578 for opt in flags. iter ( ) {
16001579 if opt. stability == OptionStability :: Stable {
0 commit comments