Skip to content

Commit

Permalink
Rollup merge of rust-lang#64446 - ehuss:fix-sanitizer-build, r=alexcr…
Browse files Browse the repository at this point in the history
…ichton

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.
  • Loading branch information
Centril authored Sep 16, 2019
2 parents 2a6a342 + 88e7556 commit f0320e5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_asan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
use cmake::Config;

fn main() {
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_lsan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
use cmake::Config;

fn main() {
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_msan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
use cmake::Config;

fn main() {
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_tsan/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use build_helper::sanitizer_lib_boilerplate;
use cmake::Config;

fn main() {
println!("cargo:rerun-if-env-changed=RUSTC_BUILD_SANITIZERS");
if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
return;
}
Expand Down

0 comments on commit f0320e5

Please sign in to comment.