Repository: gfx-rs/wgpu (language: rust)

Issue:
naga fuzz fails to link on `x86_64-pc-windows-msvc`
<!-- Thank you for filing this! Please read the [debugging tips](https://github.com/gfx-rs/wgpu/wiki/Debugging-wgpu-Applications).
That may let you investigate on your own, or provide additional information that helps us to assist.-->

**Description**
`naga-fuzz` fails to link due to a missing entry point.

**Repro steps**
Run `cargo build` on `x86_64-pc-windows-msvc`

**Platform**
`x86_64-pc-windows-msvc`


Discussion / hints:

Fix patch:
diff --git a/naga/fuzz/build.rs b/naga/fuzz/build.rs
index fa71d088aa..9ad00f53a6 100644
--- a/naga/fuzz/build.rs
+++ b/naga/fuzz/build.rs
@@ -1,5 +1,7 @@
 fn main() {
     cfg_aliases::cfg_aliases! {
-        enable_fuzzing: { not(any(target_arch = "wasm32", target_os = "ios", all(windows, target_arch = "aarch64"))) },
+        fuzzable_platform: { not(any(target_arch = "wasm32", target_os = "ios", all(windows, target_arch = "aarch64"))) },
     }
+    // This cfg provided by cargo-fuzz
+    println!("cargo::rustc-check-cfg=cfg(fuzzing)");
 }
diff --git a/naga/fuzz/fuzz_targets/glsl_parser.rs b/naga/fuzz/fuzz_targets/glsl_parser.rs
index 103a844193..159886f0c0 100644
--- a/naga/fuzz/fuzz_targets/glsl_parser.rs
+++ b/naga/fuzz/fuzz_targets/glsl_parser.rs
@@ -1,6 +1,6 @@
-#![cfg_attr(enable_fuzzing, no_main)]
+#![cfg_attr(all(fuzzable_platform, fuzzing), no_main)]
 
-#[cfg(enable_fuzzing)]
+#[cfg(all(fuzzable_platform, fuzzing))]
 mod fuzz {
     use std::iter::FromIterator;
 
@@ -40,5 +40,5 @@ mod fuzz {
     });
 }
 
-#[cfg(not(enable_fuzzing))]
+#[cfg(not(all(fuzzable_platform, fuzzing)))]
 fn main() {}
diff --git a/naga/fuzz/fuzz_targets/ir.rs b/naga/fuzz/fuzz_targets/ir.rs
index 53815c0649..f2e7bea3f7 100644
--- a/naga/fuzz/fuzz_targets/ir.rs
+++ b/naga/fuzz/fuzz_targets/ir.rs
@@ -1,6 +1,6 @@
-#![cfg_attr(enable_fuzzing, no_main)]
+#![cfg_attr(all(fuzzable_platform, fuzzing), no_main)]
 
-#[cfg(enable_fuzzing)]
+#[cfg(all(fuzzable_platform, fuzzing))]
 mod fuzz {
     use libfuzzer_sys::fuzz_target;
 
@@ -14,5 +14,5 @@ mod fuzz {
     });
 }
 
-#[cfg(not(enable_fuzzing))]
+#[cfg(not(all(fuzzable_platform, fuzzing)))]
 fn main() {}
diff --git a/naga/fuzz/fuzz_targets/spv_parser.rs b/naga/fuzz/fuzz_targets/spv_parser.rs
index cf72644cfc..2bc418c827 100644
--- a/naga/fuzz/fuzz_targets/spv_parser.rs
+++ b/naga/fuzz/fuzz_targets/spv_parser.rs
@@ -1,6 +1,6 @@
-#![cfg_attr(enable_fuzzing, no_main)]
+#![cfg_attr(all(fuzzable_platform, fuzzing), no_main)]
 
-#[cfg(enable_fuzzing)]
+#[cfg(all(fuzzable_platform, fuzzing))]
 mod fuzz {
     use libfuzzer_sys::fuzz_target;
     use naga::front::spv::{Frontend, Options};
@@ -12,5 +12,5 @@ mod fuzz {
     });
 }
 
-#[cfg(not(enable_fuzzing))]
+#[cfg(not(all(fuzzable_platform, fuzzing)))]
 fn main() {}
diff --git a/naga/fuzz/fuzz_targets/wgsl_parser.rs b/naga/fuzz/fuzz_targets/wgsl_parser.rs
index 1507ef0506..bc34912a03 100644
--- a/naga/fuzz/fuzz_targets/wgsl_parser.rs
+++ b/naga/fuzz/fuzz_targets/wgsl_parser.rs
@@ -1,6 +1,6 @@
-#![cfg_attr(enable_fuzzing, no_main)]
+#![cfg_attr(all(fuzzable_platform, fuzzing), no_main)]
 
-#[cfg(enable_fuzzing)]
+#[cfg(all(fuzzable_platform, fuzzing))]
 mod fuzz {
     use libfuzzer_sys::fuzz_target;
     use naga::front::wgsl::Frontend;
@@ -11,5 +11,5 @@ mod fuzz {
     });
 }
 
-#[cfg(not(enable_fuzzing))]
+#[cfg(not(all(fuzzable_platform, fuzzing)))]
 fn main() {}


Test patch: