diff --git a/CHANGELOG.md b/CHANGELOG.md index 83c8894..913abfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Released YYYY-MM-DD. * Bindings to `LLVMFuzzerCustomCrossOver` through the `fuzz_crossover` macro. * `example_crossover` using both `fuzz_mutator` and `fuzz_crossover` (adapted from @rigtorp) +* Support for `mut` in the `fuzz_target!` macro. ### Changed diff --git a/src/lib.rs b/src/lib.rs index 1cd12ee..6b72057 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -203,7 +203,7 @@ pub fn initialize(_argc: *const isize, _argv: *const *const *const u8) -> isize /// `"arbitrary-derive"` cargo feature. #[macro_export] macro_rules! fuzz_target { - (|$bytes:ident| $body:expr) => { + (|$bytes:pat_param| $body:expr) => { const _: () = { /// Auto-generated function #[no_mangle] @@ -249,10 +249,18 @@ macro_rules! fuzz_target { $crate::fuzz_target!(|$data| $body); }; + (|mut $data:ident: &[u8]| $body:expr) => { + $crate::fuzz_target!(|mut $data| $body); + }; + (|$data:ident: $dty:ty| $body:expr) => { $crate::fuzz_target!(|$data: $dty| -> () { $body }); }; + (|mut $data:ident: $dty:ty| $body:expr) => { + $crate::fuzz_target!(|mut $data: $dty| -> () { $body }); + }; + (|$data:ident: $dty:ty| -> $rty:ty $body:block) => { const _: () = { /// Auto-generated function