diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2016-10-19 08:00:04 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-19 08:00:04 +0300 |
| commit | 988831319e96a0cf9abcb3feb9a8da899bdb5624 (patch) | |
| tree | bd0decf1632e08a2f996ce1acad9366e9d42a783 /src | |
| parent | 903e1f96575085608407590227084430ee068d51 (diff) | |
| parent | d3c5905772d0ae1f251a5918fdaa52dbfd7519f2 (diff) | |
| download | rust-988831319e96a0cf9abcb3feb9a8da899bdb5624.tar.gz rust-988831319e96a0cf9abcb3feb9a8da899bdb5624.zip | |
Rollup merge of #37265 - brson:bootstrap, r=alexcrichton
Allow bootstrapping without a key. Fixes #36548 This will make it easier for packagers to bootstrap rustc when they happen to have a bootstrap compiler with a slightly different version number. It's not ok for anything other than the build system to set this environment variable. r? @alexcrichton
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/check.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 17 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 15 | ||||
| -rw-r--r-- | src/stage0.txt | 1 |
5 files changed, 14 insertions, 24 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index b8d0eb3ff99..af76a49fed0 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -214,7 +214,7 @@ pub fn compiletest(build: &Build, } } } - build.add_bootstrap_key(compiler, &mut cmd); + build.add_bootstrap_key(&mut cmd); cmd.arg("--adb-path").arg("adb"); cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 418c3a48ed3..ff8e4757bd1 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -119,7 +119,7 @@ fn build_startup_objects(build: &Build, target: &str, into: &Path) { for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) { let file = t!(file); let mut cmd = Command::new(&compiler_path); - build.add_bootstrap_key(&compiler, &mut cmd); + build.add_bootstrap_key(&mut cmd); build.run(cmd.arg("--target").arg(target) .arg("--emit=obj") .arg("--out-dir").arg(into) @@ -185,7 +185,6 @@ pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) { cargo.env("CFG_RELEASE", &build.release) .env("CFG_RELEASE_CHANNEL", &build.config.channel) .env("CFG_VERSION", &build.version) - .env("CFG_BOOTSTRAP_KEY", &build.bootstrap_key) .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(String::new())) .env("CFG_LIBDIR_RELATIVE", "lib"); diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 30983869c2e..a63c23b4621 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -662,7 +662,7 @@ impl Build { .env("RUSTDOC_REAL", self.rustdoc(compiler)) .env("RUSTC_FLAGS", self.rustc_flags(target).join(" ")); - self.add_bootstrap_key(compiler, &mut cargo); + self.add_bootstrap_key(&mut cargo); // Specify some various options for build scripts used throughout // the build. @@ -871,16 +871,11 @@ impl Build { } /// Adds the compiler's bootstrap key to the environment of `cmd`. - fn add_bootstrap_key(&self, compiler: &Compiler, cmd: &mut Command) { - // In stage0 we're using a previously released stable compiler, so we - // use the stage0 bootstrap key. Otherwise we use our own build's - // bootstrap key. - let bootstrap_key = if compiler.is_snapshot(self) && !self.local_rebuild { - &self.bootstrap_key_stage0 - } else { - &self.bootstrap_key - }; - cmd.env("RUSTC_BOOTSTRAP_KEY", bootstrap_key); + fn add_bootstrap_key(&self, cmd: &mut Command) { + cmd.env("RUSTC_BOOTSTRAP", ""); + // FIXME: Transitionary measure to bootstrap using the old bootstrap logic. + // Remove this once the bootstrap compiler uses the new login in Issue #36548. + cmd.env("RUSTC_BOOTSTRAP_KEY", "62b3e239"); } /// Returns the compiler's libdir where it stores the dynamic libraries that diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 9e5dfdc30c8..954fe330b54 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1330,15 +1330,12 @@ 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 + // Whether we should enable unstable features for bootstrapping + let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok(); + match (disable_unstable_features, bootstrap) { + (_, true) => UnstableFeatures::Cheat, + (true, _) => UnstableFeatures::Disallow, + (false, _) => UnstableFeatures::Allow } } diff --git a/src/stage0.txt b/src/stage0.txt index 05189f2011b..ac2050a6fc8 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -13,5 +13,4 @@ # released on `$date` rustc: beta-2016-09-28 -rustc_key: 62b3e239 cargo: nightly-2016-09-26 |
