Skip to content

Commit 9707e9c

Browse files
authored
Fix enabling cfg(gc_zeal) during fuzzing (#13123)
This commit fixes a minor mistake from #13053 where `cfg!(fuzzing)` isn't set for build scripts because `RUSTFLAGS`, where `--cfg fuzzing` is specified, is only passed to target artifacts, not build scripts. This means that the lookup must happen via Cargo's set env vars (e.g. `CARGO_CFG_FUZZING`), not `cfg!(...)`.
1 parent f78f8b0 commit 9707e9c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

crates/cranelift/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
2-
if cfg!(fuzzing) {
2+
if std::env::var("CARGO_CFG_FUZZING").is_ok() {
33
println!("cargo:rustc-cfg=gc_zeal");
44
}
55
}

crates/wasmtime/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434
custom_cfg("has_virtual_memory", has_virtual_memory);
3535
custom_cfg("has_custom_sync", has_custom_sync);
3636
custom_cfg("has_host_compiler_backend", has_host_compiler_backend);
37-
custom_cfg("gc_zeal", cfg!(fuzzing));
37+
custom_cfg("gc_zeal", cfg("fuzzing"));
3838

3939
// If this OS isn't supported and no debug-builtins or if Cranelift doesn't support
4040
// the host or there's no need to build these helpers.

0 commit comments

Comments
 (0)