Skip to content

Commit c822546

Browse files
committed
mk: Hardcode the bootstrap key for each release
Starting with the 1.10.0 release we would like to bootstrap all compilers from the previous stable release. For example the 1.10.0 compiler should bootstrap from the literal 1.9.0 release artifacts. To do this, however, we need a way to enable unstable features temporarily in a stable compiler (as the released compiler is stable), but it turns out we already have a way to do that! At compile time the configure script selects a `CFG_BOOTSTRAP_KEY` variable value and then exports it into the makefiles. If the `RUSTC_BOOTSTRAP_KEY` environment variable is set to this value, then the compiler is allowed to "cheat" and use unstable features. This method of choosing the bootstrap key, however, is problematic for the intention of bootstrapping from the previous release. Each time a 1.9.0 compiler is created, a new bootstrap key will be selected. That means that the 1.10.0 compiler will only compile from *our* literal release artifacts. Instead distributions would like to bootstrap from their own compilers, so instead we simply hardcode the bootstrap key for each release. This patch uses the same `CFG_FILENAME_EXTRA` value (a hash of the release string) as the bootstrap key. Consequently all 1.9.0 compilers, no matter where they are compiled, will have the same bootstrap key. Additionally we won't need to keep updating this as it'll be based on the release number anyway. Once the 1.9.0 beta has been created, we can update the 1.10.0 nightly sources (the `master` branch at that time) to bootstrap from that release using this hard-coded bootstrap key. We will likely just hardcode into the makefiles what the previous bootstrap key was and we'll change that whenever the stage0 compiler is updated.
1 parent 080edd9 commit c822546

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

configure

-12
Original file line numberDiff line numberDiff line change
@@ -716,18 +716,6 @@ if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; f
716716

717717
if [ -n "$CFG_ENABLE_ORBIT" ]; then putvar CFG_ENABLE_ORBIT; fi
718718

719-
# A magic value that allows the compiler to use unstable features
720-
# during the bootstrap even when doing so would normally be an error
721-
# because of feature staging or because the build turns on
722-
# warnings-as-errors and unstable features default to warnings. The
723-
# build has to match this key in an env var. Meant to be a mild
724-
# deterrent from users just turning on unstable features on the stable
725-
# channel.
726-
# Basing CFG_BOOTSTRAP_KEY on CFG_BOOTSTRAP_KEY lets it get picked up
727-
# during a Makefile reconfig.
728-
CFG_BOOTSTRAP_KEY="${CFG_BOOTSTRAP_KEY-`date +%H:%M:%S`}"
729-
putvar CFG_BOOTSTRAP_KEY
730-
731719
step_msg "looking for build programs"
732720

733721
probe_need CFG_CURLORWGET curl wget

mk/main.mk

+11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ CFG_PRERELEASE_VERSION=.1
2424
# versions in the same place
2525
CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))
2626

27+
# A magic value that allows the compiler to use unstable features during the
28+
# bootstrap even when doing so would normally be an error because of feature
29+
# staging or because the build turns on warnings-as-errors and unstable features
30+
# default to warnings. The build has to match this key in an env var.
31+
#
32+
# This value is keyed off the release to ensure that all compilers for one
33+
# particular release have the same bootstrap key. Note that this is
34+
# intentionally not "secure" by any definition, this is largely just a deterrent
35+
# from users enabling unstable features on the stable compiler.
36+
CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)
37+
2738
ifeq ($(CFG_RELEASE_CHANNEL),stable)
2839
# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
2940
CFG_RELEASE=$(CFG_RELEASE_NUM)

0 commit comments

Comments
 (0)