From d495f3e0741ab2889da8925eac6e4986218ba753 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 6 Oct 2024 16:32:03 -0700 Subject: [PATCH] Fix fuzzer and bench build --- crates/wasmparser/benches/benchmark.rs | 18 ++++++++++++++++++ fuzz/src/validate.rs | 2 ++ 2 files changed, 20 insertions(+) diff --git a/crates/wasmparser/benches/benchmark.rs b/crates/wasmparser/benches/benchmark.rs index 49c9399cb4..e9149e189a 100644 --- a/crates/wasmparser/benches/benchmark.rs +++ b/crates/wasmparser/benches/benchmark.rs @@ -218,6 +218,24 @@ fn read_all_wasm(wasm: &[u8]) -> Result<()> { | CustomSection { .. } | CodeSectionStart { .. } | End(_) => {} + + other => { + // NB: if you hit this panic if you'd be so kind as to grep + // through other locations in the code base that need to be + // updated as well. As of the time of this writing the locations + // might be: + // + // * src/bin/wasm-tools/objdump.rs + // * src/bin/wasm-tools/dump.rs + // * crates/wasm-encoder/src/reencode.rs + // * crates/wasm-encoder/src/reencode/component.rs + // * crates/wasmprinter/src/lib.rs + // * crates/wit-component/src/gc.rs + // + // This is required due to the `#[non_exhaustive]` nature of + // the `Payload` enum. + panic!("a new match statement should be added above for this case: {other:?}") + } } } Ok(()) diff --git a/fuzz/src/validate.rs b/fuzz/src/validate.rs index 2e849a0533..ff14c1875d 100644 --- a/fuzz/src/validate.rs +++ b/fuzz/src/validate.rs @@ -102,6 +102,8 @@ fn validate_all(u: &mut Unstructured<'_>, mut validator: Validator, wasm: &[u8]) // No associated range. End(_) => {} + + _ => {} } }