Skip to content

Commit db7afeb

Browse files
heisen-liweihanglo
authored andcommitted
fix: rerun build script when target rustflags changed
fixes #13003
1 parent cdda900 commit db7afeb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/cargo/core/compiler/fingerprint/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,11 +1526,14 @@ See https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-change
15261526
.collect::<CargoResult<Vec<_>>>()?
15271527
};
15281528

1529+
let rustflags = build_runner.bcx.rustflags_args(unit).to_vec();
1530+
15291531
Ok(Fingerprint {
15301532
local: Mutex::new(local),
15311533
rustc: util::hash_u64(&build_runner.bcx.rustc().verbose_version),
15321534
deps,
15331535
outputs: if overridden { Vec::new() } else { vec![output] },
1536+
rustflags,
15341537

15351538
// Most of the other info is blank here as we don't really include it
15361539
// in the execution of the build script, but... this may be a latent

tests/testsuite/build_script.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5578,6 +5578,9 @@ fn build_script_rerun_when_target_rustflags_change() {
55785578
[RUNNING] [..]
55795579
",
55805580
)
5581-
.with_stdout("")
5581+
.with_stdout(
5582+
"\
5583+
hello",
5584+
)
55825585
.run();
55835586
}

0 commit comments

Comments
 (0)