Skip to content

Commit

Permalink
Let any bootstrap key suffice to allow features
Browse files Browse the repository at this point in the history
This is a follow-up to pull request rust-lang#32812, according to the new
decision in issue rust-lang#36548 to relax bootstrap key logic.  Now *any*
non-empty bootstrap key is allowed to circumvent the feature gate.

For now, the build system still goes through the same motions to set
RUSTC_BOOTSTRAP_KEY according to the prior system.  This is necessary
at least until the next stage0 base includes this relaxed key check.
It also makes it simpler to revert this if we change our mind.
  • Loading branch information
cuviper committed Oct 19, 2016
1 parent 16eeeac commit 2c76ee9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,15 +1317,13 @@ impl UnstableFeatures {
pub fn from_environment() -> UnstableFeatures {
// Whether this is a feature-staged build, i.e. on the beta or stable channel
let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some();
// The secret key needed to get through the rustc build itself by
// subverting the unstable features lints
let bootstrap_secret_key = option_env!("CFG_BOOTSTRAP_KEY");
// The matching key to the above, only known by the build system
let bootstrap_provided_key = env::var("RUSTC_BOOTSTRAP_KEY").ok();
match (disable_unstable_features, bootstrap_secret_key, bootstrap_provided_key) {
(_, Some(ref s), Some(ref p)) if s == p => UnstableFeatures::Cheat,
(true, _, _) => UnstableFeatures::Disallow,
(false, _, _) => UnstableFeatures::Allow
// Check whether we want to circumvent the unstable feature kill-switch for bootstrap
let bootstrap_circumvent = env::var_os("RUSTC_BOOTSTRAP_KEY")
.map_or(false, |e| !e.is_empty());
match (disable_unstable_features, bootstrap_circumvent) {
(_, true) => UnstableFeatures::Cheat,
(true, _) => UnstableFeatures::Disallow,
(false, _) => UnstableFeatures::Allow
}
}

Expand Down

0 comments on commit 2c76ee9

Please sign in to comment.