Skip to content

Commit 0c42987

Browse files
authored
Auto merge of #37269 - eddyb:rollup, r=eddyb
Rollup of 23 pull requests - Successful merges: #36964, #37108, #37117, #37124, #37161, #37176, #37182, #37193, #37198, #37202, #37208, #37218, #37221, #37224, #37230, #37231, #37233, #37236, #37240, #37254, #37257, #37265, #37267 - Failed merges: #37213, #37220, #37261
2 parents 16eeeac + f354d72 commit 0c42987

File tree

223 files changed

+2675
-813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+2675
-813
lines changed

appveyor.yml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
environment:
2+
matrix:
3+
# 32/64 bit MSVC
4+
- MSYS_BITS: 64
5+
TARGET: x86_64-pc-windows-msvc
6+
CHECK: check
7+
CONFIGURE_ARGS: --enable-llvm-assertions --enable-debug-assertions
8+
- MSYS_BITS: 32
9+
TARGET: i686-pc-windows-msvc
10+
CHECK: check
11+
CONFIGURE_ARGS: --enable-llvm-assertions --enable-debug-assertions
12+
13+
# MSVC rustbuild
14+
- MSYS_BITS: 64
15+
CONFIGURE_ARGS: --enable-rustbuild --enable-llvm-assertions --enable-debug-assertions
16+
TARGET: x86_64-pc-windows-msvc
17+
CHECK: check
18+
19+
# MSVC cargotest
20+
- MSYS_BITS: 64
21+
CONFIGURE_ARGS: --enable-rustbuild --enable-llvm-assertions --enable-debug-assertions
22+
TARGET: x86_64-pc-windows-msvc
23+
CHECK: check-cargotest
24+
25+
# 32/64-bit MinGW builds.
26+
#
27+
# The MinGW builds unfortunately have to both download a custom toolchain and
28+
# avoid the one installed by AppVeyor by default. Interestingly, though, for
29+
# different reasons!
30+
#
31+
# For 32-bit the installed gcc toolchain on AppVeyor uses the pthread
32+
# threading model. This is unfortunately not what we want, and if we compile
33+
# with it then there's lots of link errors in the standard library (undefined
34+
# references to pthread symbols).
35+
#
36+
# For 64-bit the installed gcc toolchain is currently 5.3.0 which
37+
# unfortunately segfaults on Windows with --enable-llvm-assertions (segfaults
38+
# in LLVM). See rust-lang/rust#28445 for more information, but to work around
39+
# this we go back in time to 4.9.2 specifically.
40+
#
41+
# Finally, note that the downloads below are all in the `rust-lang-ci` S3
42+
# bucket, but they cleraly didn't originate there! The downloads originally
43+
# came from the mingw-w64 SourceForge download site. Unfortunately
44+
# SourceForge is notoriously flaky, so we mirror it on our own infrastructure.
45+
#
46+
# And as a final point of note, the 32-bit MinGW build using the makefiles do
47+
# *not* use debug assertions and llvm assertions. This is because they take
48+
# too long on appveyor and this is tested by rustbuild below.
49+
- MSYS_BITS: 32
50+
TARGET: i686-pc-windows-gnu
51+
CHECK: check
52+
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
53+
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
54+
MINGW_DIR: mingw32
55+
56+
- MSYS_BITS: 32
57+
CONFIGURE_ARGS: --enable-rustbuild --enable-llvm-assertions --enable-debug-assertions
58+
TARGET: i686-pc-windows-gnu
59+
CHECK: check
60+
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
61+
MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
62+
MINGW_DIR: mingw32
63+
64+
- MSYS_BITS: 64
65+
CONFIGURE_ARGS: --enable-llvm-assertions --enable-debug-assertions
66+
TARGET: x86_64-pc-windows-gnu
67+
CHECK: check
68+
MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
69+
MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
70+
MINGW_DIR: mingw64
71+
72+
clone_depth: 1
73+
build: false
74+
75+
install:
76+
# If we need to download a custom MinGW, do so here and set the path
77+
# appropriately.
78+
#
79+
# Note that this *also* means that we're not using what is typically
80+
# /mingw32/bin/python2.7.exe, which is a "correct" python interpreter where
81+
# /usr/bin/python2.7.exe is not. To ensure we use the right interpreter we
82+
# move `C:\Python27` ahead in PATH and then also make sure the `python2.7.exe`
83+
# file exists in there (which it doesn't by default).
84+
- if defined MINGW_URL appveyor DownloadFile %MINGW_URL%/%MINGW_ARCHIVE%
85+
- if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
86+
- if defined MINGW_URL set PATH=C:\Python27;%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%
87+
- if defined MINGW_URL copy C:\Python27\python.exe C:\Python27\python2.7.exe
88+
89+
# Otherwise pull in the MinGW installed on appveyor
90+
- if NOT defined MINGW_URL set PATH=C:\msys64\mingw%MSYS_BITS%\bin;C:\msys64\usr\bin;%PATH%
91+
92+
test_script:
93+
- sh ./configure
94+
%CONFIGURE_ARGS%
95+
--build=%TARGET%
96+
- bash -c "make -j$(nproc)"
97+
- bash -c "make %CHECK% -j$(nproc)"
98+
99+
cache:
100+
- build/%TARGET%/llvm -> src/rustllvm/llvm-auto-clean-trigger
101+
- "%TARGET%/llvm -> src/rustllvm/llvm-auto-clean-trigger"
102+
103+
branches:
104+
only:
105+
- auto
106+
107+
# init:
108+
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
109+
# on_finish:
110+
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

mk/llvm.mk

+13-19
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,27 @@ endif
3636
# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
3737
ifeq ($(CFG_LLVM_ROOT),)
3838

39-
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
39+
LLVM_STAMP_$(1) = $(S)src/rustllvm/llvm-auto-clean-trigger
4040
LLVM_DONE_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-finished-building
4141

4242
$$(LLVM_CONFIG_$(1)): $$(LLVM_DONE_$(1))
4343

44-
$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
45-
@$$(call E, cmake: llvm)
4644
ifneq ($$(CFG_NINJA),)
47-
$$(Q)$$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1))
45+
BUILD_LLVM_$(1) := $$(CFG_NINJA) -C $$(CFG_LLVM_BUILD_DIR_$(1))
4846
else ifeq ($$(findstring msvc,$(1)),msvc)
49-
$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
50-
--config $$(LLVM_BUILD_CONFIG_MODE)
47+
BUILD_LLVM_$(1) := $$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
48+
--config $$(LLVM_BUILD_CONFIG_MODE)
5149
else
52-
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
50+
BUILD_LLVM_$(1) := $$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
5351
endif
54-
$$(Q)touch $$@
52+
53+
$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
54+
@$$(call E, cmake: llvm)
55+
$$(Q)if ! cmp $$(LLVM_STAMP_$(1)) $$(LLVM_DONE_$(1)); then \
56+
$$(MAKE) clean-llvm$(1); \
57+
$$(BUILD_LLVM_$(1)); \
58+
fi
59+
$$(Q)cp $$(LLVM_STAMP_$(1)) $$@
5560

5661
ifneq ($$(CFG_NINJA),)
5762
clean-llvm$(1):
@@ -75,17 +80,6 @@ endif
7580

7681
$$(LLVM_AR_$(1)): $$(LLVM_CONFIG_$(1))
7782

78-
# This is used to independently force an LLVM clean rebuild
79-
# when we changed something not otherwise captured by builtin
80-
# dependencies. In these cases, commit a change that touches
81-
# the stamp in the source dir.
82-
$$(LLVM_STAMP_$(1)): $$(S)src/rustllvm/llvm-auto-clean-trigger
83-
@$$(call E, make: cleaning llvm)
84-
$$(Q)touch $$@.start_time
85-
$$(Q)$$(MAKE) clean-llvm$(1)
86-
@$$(call E, make: done cleaning llvm)
87-
touch -r $$@.start_time $$@ && rm $$@.start_time
88-
8983
ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
9084
LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
9185
-print-file-name=lib$(CFG_STDCPP_NAME).a))"

mk/main.mk

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

56-
# A magic value that allows the compiler to use unstable features during the
57-
# bootstrap even when doing so would normally be an error because of feature
58-
# staging or because the build turns on warnings-as-errors and unstable features
59-
# default to warnings. The build has to match this key in an env var.
60-
#
61-
# This value is keyed off the release to ensure that all compilers for one
62-
# particular release have the same bootstrap key. Note that this is
63-
# intentionally not "secure" by any definition, this is largely just a deterrent
64-
# from users enabling unstable features on the stable compiler.
65-
CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)
66-
6756
# If local-rust is the same as the current version, then force a local-rebuild
6857
ifdef CFG_ENABLE_LOCAL_RUST
6958
ifeq ($(CFG_RELEASE),\
@@ -73,14 +62,6 @@ ifeq ($(CFG_RELEASE),\
7362
endif
7463
endif
7564

76-
# The stage0 compiler needs to use the previous key recorded in src/stage0.txt,
77-
# except for local-rebuild when it just uses the same current key.
78-
ifdef CFG_ENABLE_LOCAL_REBUILD
79-
CFG_BOOTSTRAP_KEY_STAGE0=$(CFG_BOOTSTRAP_KEY)
80-
else
81-
CFG_BOOTSTRAP_KEY_STAGE0=$(shell sed -ne 's/^rustc_key: //p' $(S)src/stage0.txt)
82-
endif
83-
8465
# The name of the package to use for creating tarballs, installers etc.
8566
CFG_PACKAGE_NAME=rustc-$(CFG_PACKAGE_VERS)
8667

@@ -387,13 +368,16 @@ CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATUR
387368
# Turn on feature-staging
388369
export CFG_DISABLE_UNSTABLE_FEATURES
389370
# Subvert unstable feature lints to do the self-build
390-
export RUSTC_BOOTSTRAP_KEY:=$(CFG_BOOTSTRAP_KEY)
371+
export RUSTC_BOOTSTRAP
391372
endif
392-
export CFG_BOOTSTRAP_KEY
393373
ifdef CFG_MUSL_ROOT
394374
export CFG_MUSL_ROOT
395375
endif
396376

377+
# FIXME: Transitionary measure to bootstrap using the old bootstrap logic.
378+
# Remove this once the bootstrap compiler uses the new login in Issue #36548.
379+
export RUSTC_BOOTSTRAP_KEY=62b3e239
380+
397381
######################################################################
398382
# Per-stage targets and runner
399383
######################################################################

mk/target.mk

-21
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ $(foreach host,$(CFG_HOST), \
4242
$(foreach crate,$(CRATES), \
4343
$(eval $(call RUST_CRATE_FULLDEPS,$(stage),$(target),$(host),$(crate)))))))
4444

45-
# $(1) stage
46-
# $(2) target
47-
# $(3) host
48-
define DEFINE_BOOTSTRAP_KEY
49-
BOOTSTRAP_KEY$(1)_T_$(2)_H_$(3) := $$(CFG_BOOTSTRAP_KEY)
50-
ifeq ($(1),0)
51-
ifeq ($(3),$$(CFG_BUILD))
52-
BOOTSTRAP_KEY$(1)_T_$(2)_H_$(3) := $$(CFG_BOOTSTRAP_KEY_STAGE0)
53-
endif
54-
endif
55-
endef
56-
57-
$(foreach host,$(CFG_TARGET), \
58-
$(foreach target,$(CFG_TARGET), \
59-
$(foreach stage,$(STAGES), \
60-
$(eval $(call DEFINE_BOOTSTRAP_KEY,$(stage),$(target),$(host))))))
61-
6245
# RUST_TARGET_STAGE_N template: This defines how target artifacts are built
6346
# for all stage/target architecture combinations. This is one giant rule which
6447
# works as follows:
@@ -83,8 +66,6 @@ $(foreach host,$(CFG_TARGET), \
8366
define RUST_TARGET_STAGE_N
8467

8568
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
86-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
87-
export RUSTC_BOOTSTRAP_KEY := $$(BOOTSTRAP_KEY$(1)_T_$(2)_H_$(3))
8869
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
8970
$$(CRATEFILE_$(4)) \
9071
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
@@ -132,8 +113,6 @@ endef
132113
# $(4) - name of the tool being built
133114
define TARGET_TOOL
134115

135-
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
136-
export RUSTC_BOOTSTRAP_KEY := $$(BOOTSTRAP_KEY$(1)_T_$(2)_H_$(3))
137116
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
138117
$$(TOOL_SOURCE_$(4)) \
139118
$$(TOOL_INPUTS_$(4)) \

src/bootstrap/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub fn compiletest(build: &Build,
214214
}
215215
}
216216
}
217-
build.add_bootstrap_key(compiler, &mut cmd);
217+
build.add_bootstrap_key(&mut cmd);
218218

219219
cmd.arg("--adb-path").arg("adb");
220220
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);

src/bootstrap/compile.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn build_startup_objects(build: &Build, target: &str, into: &Path) {
119119
for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) {
120120
let file = t!(file);
121121
let mut cmd = Command::new(&compiler_path);
122-
build.add_bootstrap_key(&compiler, &mut cmd);
122+
build.add_bootstrap_key(&mut cmd);
123123
build.run(cmd.arg("--target").arg(target)
124124
.arg("--emit=obj")
125125
.arg("--out-dir").arg(into)
@@ -185,7 +185,6 @@ pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
185185
cargo.env("CFG_RELEASE", &build.release)
186186
.env("CFG_RELEASE_CHANNEL", &build.config.channel)
187187
.env("CFG_VERSION", &build.version)
188-
.env("CFG_BOOTSTRAP_KEY", &build.bootstrap_key)
189188
.env("CFG_PREFIX", build.config.prefix.clone().unwrap_or(String::new()))
190189
.env("CFG_LIBDIR_RELATIVE", "lib");
191190

src/bootstrap/config.rs

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ struct Build {
120120
rustc: Option<String>,
121121
compiler_docs: Option<bool>,
122122
docs: Option<bool>,
123+
submodules: Option<bool>,
123124
}
124125

125126
/// TOML representation of how the LLVM build is configured.
@@ -225,6 +226,7 @@ impl Config {
225226
config.cargo = build.cargo.map(PathBuf::from);
226227
set(&mut config.compiler_docs, build.compiler_docs);
227228
set(&mut config.docs, build.docs);
229+
set(&mut config.submodules, build.submodules);
228230

229231
if let Some(ref llvm) = toml.llvm {
230232
set(&mut config.ccache, llvm.ccache);

src/bootstrap/config.toml.example

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@
7676
# library and facade crates.
7777
#compiler-docs = false
7878

79+
# Indicate whether submodules are managed and updated automatically.
80+
#submodules = true
81+
7982
# =============================================================================
8083
# Options for compiling Rust code itself
8184
# =============================================================================

src/bootstrap/lib.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ impl Build {
662662
.env("RUSTDOC_REAL", self.rustdoc(compiler))
663663
.env("RUSTC_FLAGS", self.rustc_flags(target).join(" "));
664664

665-
self.add_bootstrap_key(compiler, &mut cargo);
665+
self.add_bootstrap_key(&mut cargo);
666666

667667
// Specify some various options for build scripts used throughout
668668
// the build.
@@ -871,16 +871,11 @@ impl Build {
871871
}
872872

873873
/// Adds the compiler's bootstrap key to the environment of `cmd`.
874-
fn add_bootstrap_key(&self, compiler: &Compiler, cmd: &mut Command) {
875-
// In stage0 we're using a previously released stable compiler, so we
876-
// use the stage0 bootstrap key. Otherwise we use our own build's
877-
// bootstrap key.
878-
let bootstrap_key = if compiler.is_snapshot(self) && !self.local_rebuild {
879-
&self.bootstrap_key_stage0
880-
} else {
881-
&self.bootstrap_key
882-
};
883-
cmd.env("RUSTC_BOOTSTRAP_KEY", bootstrap_key);
874+
fn add_bootstrap_key(&self, cmd: &mut Command) {
875+
cmd.env("RUSTC_BOOTSTRAP", "");
876+
// FIXME: Transitionary measure to bootstrap using the old bootstrap logic.
877+
// Remove this once the bootstrap compiler uses the new login in Issue #36548.
878+
cmd.env("RUSTC_BOOTSTRAP_KEY", "62b3e239");
884879
}
885880

886881
/// Returns the compiler's libdir where it stores the dynamic libraries that

0 commit comments

Comments
 (0)