Skip to content

Commit 7bccb82

Browse files
authored
Auto merge of #37273 - cuviper:major-minor-rebuild, r=alexcrichton
Detect local-rebuild by just the MAJOR.MINOR version A new point-release shouldn't change any language semantics, so a local stage0 that matches MAJOR.MINOR version should still be considered a local-rebuild as far as `--cfg stageN` features go. e.g. `1.14.0` should be considered a local-rebuild for any `1.14.X`. (Bootstrap keys used to be an issue too, until #37265.)
2 parents eb38d42 + 81d9795 commit 7bccb82

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

mk/main.mk

+5-4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ endif
5353
# versions in the same place
5454
CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))
5555

56-
# If local-rust is the same as the current version, then force a local-rebuild
56+
# If local-rust is the same major.minor as the current version, then force a local-rebuild
5757
ifdef CFG_ENABLE_LOCAL_RUST
58-
ifeq ($(CFG_RELEASE),\
59-
$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT)))
60-
CFG_INFO := $(info cfg: auto-detected local-rebuild $(CFG_RELEASE))
58+
SEMVER_PREFIX=$(shell echo $(CFG_RELEASE_NUM) | grep -E -o '^[[:digit:]]+\.[[:digit:]]+')
59+
LOCAL_RELEASE=$(shell $(S)src/etc/local_stage0.sh --print-rustc-release $(CFG_LOCAL_RUST_ROOT))
60+
ifneq (,$(filter $(SEMVER_PREFIX).%,$(LOCAL_RELEASE)))
61+
CFG_INFO := $(info cfg: auto-detected local-rebuild using $(LOCAL_RELEASE))
6162
CFG_ENABLE_LOCAL_REBUILD = 1
6263
endif
6364
endif

src/bootstrap/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ impl Build {
220220
sanity::check(self);
221221
self.verbose("collecting channel variables");
222222
channel::collect(self);
223-
// If local-rust is the same as the current version, then force a local-rebuild
223+
// If local-rust is the same major.minor as the current version, then force a local-rebuild
224224
let local_version_verbose = output(
225225
Command::new(&self.rustc).arg("--version").arg("--verbose"));
226226
let local_release = local_version_verbose
227227
.lines().filter(|x| x.starts_with("release:"))
228228
.next().unwrap().trim_left_matches("release:").trim();
229-
if local_release == self.release {
230-
self.verbose(&format!("auto-detected local-rebuild {}", self.release));
229+
if local_release.split('.').take(2).eq(self.release.split('.').take(2)) {
230+
self.verbose(&format!("auto-detected local-rebuild {}", local_release));
231231
self.local_rebuild = true;
232232
}
233233
self.verbose("updating submodules");

0 commit comments

Comments
 (0)