Skip to content

Commit f0320e5

Browse files
authored
Rollup merge of rust-lang#64446 - ehuss:fix-sanitizer-build, r=alexcrichton
Fix build script sanitizer check. rust-lang#64166 changed the way the sanitizer build scripts work. However, they were changed so that they switch between new-style to old-style cargo fingerprints. This trips up on rust-lang/cargo#6779. It also causes rustbuild to panic. If you build stage1 std (with sanitizers off), and then enable sanitizers, it panics. (This is because the build scripts don't declare that they need to re-run.) This PR will trip rust-lang/cargo#6779 again, unfortunately. I've been having way too many unexplained rebuilds in rust-lang/rust recently, but at least I'll know why this time. This doesn't fix all problems with the build scripts, but arguably they should be fixed in cargo. For example, the build scripts change which rerun-if statements they declare between runs which triggers rust-lang/cargo#7362. The test for this is: 1. Turn off sanitizers (which is the default) 2. `./x.py build --stage=1 src/libstd` 3. `./x.py build --stage=1 src/libstd` again should be a null build. 4. Enable sanitizers. 5. `./x.py build --stage=1 src/libstd` should rebuild with sanitizers enabled. 6. `./x.py build --stage=1 src/libstd` again should be a null build. This actually rebuilds due to rust-lang/cargo#7362 because the rerun-if directives changed between step 3 and 5. A 3rd attempt should be a null build.
2 parents 2a6a342 + 88e7556 commit f0320e5

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

src/librustc_asan/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
44
use cmake::Config;
55

66
fn main() {
7+
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
78
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
89
return;
910
}

src/librustc_lsan/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
44
use cmake::Config;
55

66
fn main() {
7+
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
78
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
89
return;
910
}

src/librustc_msan/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
44
use cmake::Config;
55

66
fn main() {
7+
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
78
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
89
return;
910
}

src/librustc_tsan/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
44
use cmake::Config;
55

66
fn main() {
7+
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
78
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
89
return;
910
}

0 commit comments

Comments
 (0)