Skip to content

Commit 2c76ee9

Browse files
committed
Let any bootstrap key suffice to allow features
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.
1 parent 16eeeac commit 2c76ee9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,15 +1317,13 @@ impl UnstableFeatures {
13171317
pub fn from_environment() -> UnstableFeatures {
13181318
// Whether this is a feature-staged build, i.e. on the beta or stable channel
13191319
let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some();
1320-
// The secret key needed to get through the rustc build itself by
1321-
// subverting the unstable features lints
1322-
let bootstrap_secret_key = option_env!("CFG_BOOTSTRAP_KEY");
1323-
// The matching key to the above, only known by the build system
1324-
let bootstrap_provided_key = env::var("RUSTC_BOOTSTRAP_KEY").ok();
1325-
match (disable_unstable_features, bootstrap_secret_key, bootstrap_provided_key) {
1326-
(_, Some(ref s), Some(ref p)) if s == p => UnstableFeatures::Cheat,
1327-
(true, _, _) => UnstableFeatures::Disallow,
1328-
(false, _, _) => UnstableFeatures::Allow
1320+
// Check whether we want to circumvent the unstable feature kill-switch for bootstrap
1321+
let bootstrap_circumvent = env::var_os("RUSTC_BOOTSTRAP_KEY")
1322+
.map_or(false, |e| !e.is_empty());
1323+
match (disable_unstable_features, bootstrap_circumvent) {
1324+
(_, true) => UnstableFeatures::Cheat,
1325+
(true, _) => UnstableFeatures::Disallow,
1326+
(false, _) => UnstableFeatures::Allow
13291327
}
13301328
}
13311329

0 commit comments

Comments
 (0)