Skip to content

Commit 0de9b0e

Browse files
committed
---
yaml --- r: 179567 b: refs/heads/master c: cacd6b6 h: refs/heads/master i: 179565: 618dffd 179563: 0114cd3 179559: d3c0e37 179551: aec7216 v: v3
1 parent 633aae4 commit 0de9b0e

File tree

6 files changed

+405
-176
lines changed

6 files changed

+405
-176
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0ba9e1fa52627404a1e5b90f745f96a872a0c564
2+
refs/heads/master: cacd6b66f1ba4dc24f57cfeda4a41fc6eeb35762
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 0ba9e1fa52627404a1e5b90f745f96a872a0c564
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77

trunk/src/librustc/session/config.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ use syntax::diagnostic::{ColorConfig, Auto, Always, Never, SpanHandler};
3333
use syntax::parse;
3434
use syntax::parse::token::InternedString;
3535

36+
use getopts;
3637
use std::collections::HashMap;
3738
use std::collections::hash_map::Entry::{Occupied, Vacant};
38-
use getopts;
3939
use std::fmt;
40+
use std::os;
4041

4142
use llvm;
4243

@@ -821,7 +822,6 @@ pub fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
821822
}
822823

823824
pub fn build_session_options(matches: &getopts::Matches) -> Options {
824-
825825
let unparsed_crate_types = matches.opt_strs("crate-type");
826826
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
827827
.unwrap_or_else(|e| early_error(&e[]));
@@ -1041,7 +1041,22 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
10411041
crate_name: crate_name,
10421042
alt_std_name: None,
10431043
libs: libs,
1044-
unstable_features: UnstableFeatures::Disallow
1044+
unstable_features: get_unstable_features_setting(),
1045+
}
1046+
}
1047+
1048+
pub fn get_unstable_features_setting() -> UnstableFeatures {
1049+
// Whether this is a feature-staged build, i.e. on the beta or stable channel
1050+
let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some();
1051+
// The secret key needed to get through the rustc build itself by
1052+
// subverting the unstable features lints
1053+
let bootstrap_secret_key = option_env!("CFG_BOOTSTRAP_KEY");
1054+
// The matching key to the above, only known by the build system
1055+
let bootstrap_provided_key = env::var_string("RUSTC_BOOTSTRAP_KEY").ok();
1056+
match (disable_unstable_features, bootstrap_secret_key, bootstrap_provided_key) {
1057+
(_, Some(ref s), Some(ref p)) if s == p => UnstableFeatures::Cheat,
1058+
(true, _, _) => UnstableFeatures::Disallow,
1059+
(false, _, _) => UnstableFeatures::Default
10451060
}
10461061
}
10471062

0 commit comments

Comments
 (0)