1## Unreleased 2 3Released YYYY-MM-DD. 4 5### Added 6 7* TODO (or remove section if none) 8 9### Changed 10 11* TODO (or remove section if none) 12 13### Deprecated 14 15* TODO (or remove section if none) 16 17### Removed 18 19* TODO (or remove section if none) 20 21### Fixed 22 23* TODO (or remove section if none) 24 25### Security 26 27* TODO (or remove section if none) 28 29-------------------------------------------------------------------------------- 30 31## 1.4.0 32 33Released 2024-10-30. 34 35### Added 36 37* Added an `Arbitrary` implementation for `PhantomPinned`. 38* Added the `Unstructured::choose_iter` helper method. 39* Added `#[arbitrary(skip)]` for `enum` variants in the derive macro. 40* Added the `Arbitrary::try_size_hint` trait method. 41 42### Changed 43 44* Implement `Arbitrary` for `PhantomData<A>` even when `A` does not implement 45 `Arbitrary` and when `A` is `?Sized`. 46* Make `usize`'s underlying encoding independent of machine word size so that 47 corpora are more portable. 48 49### Fixed 50 51* Make `derive(Arbitrary)` work for local definitions of `struct Option`. 52 53-------------------------------------------------------------------------------- 54 55## 1.3.2 56 57Released 2023-10-30. 58 59### Added 60 61* Added `Arbitrary` implementations for `Arc<[T]>` and 62 `Rc<[T]>`. [#160](https://github.com/rust-fuzz/arbitrary/pull/160) 63 64-------------------------------------------------------------------------------- 65 66## 1.3.1 67 68Released 2023-10-11. 69 70### Fixed 71 72* Fixed an issue with generating collections of collections in 73 `arbitrary_take_rest` where `<Vec<Vec<u8>>>::arbitrary_take_rest` would never 74 generate `vec![vec![]]` for example. See 75 [#159](https://github.com/rust-fuzz/arbitrary/pull/159) for details. 76 77-------------------------------------------------------------------------------- 78 79## 1.3.0 80 81Released 2023-03-13. 82 83### Added 84 85* Added the ability to manually specify derived trait bounds for 86 `Arbitrary`. See [#138](https://github.com/rust-fuzz/arbitrary/pull/138) for 87 details. 88 89### Fixed 90 91* Fixed minimal versions correctness for `syn`. 92 93-------------------------------------------------------------------------------- 94 95## 1.2.3 96 97Released 2023-01-20. 98 99### Fixed 100 101* The `derive(Arbitrary)` will now annotate the generated `impl`s with a `#[automatically_derived]` 102 attribute to indicate to e.g. clippy that lints should not fire for the code within the derived 103 implementation. 104 105## 1.2.2 106 107Released 2023-01-03. 108 109### Fixed 110 111* Ensured that `arbitrary` and `derive_arbitrary` versions are synced up so that 112 they don't, e.g., emit generated code that depends on newer versions of 113 `arbitrary` than the one currently in 114 use. [#134](https://github.com/rust-fuzz/arbitrary/issues/134) 115 116## 1.2.1 117 118### Fixed 119 120* Fixed an issue where `std::thread_local!` macro invocations in derive code 121 were not fully prefixed, causing confusing build errors in certain situations. 122 123## 1.2.0 124 125Released 2022-10-20. 126 127### Added 128 129* Support custom arbitrary implementation for fields on 130 derive. [#129](https://github.com/rust-fuzz/arbitrary/pull/129) 131 132-------------------------------------------------------------------------------- 133 134## 1.1.6 135 136Released 2022-09-20. 137 138### Fixed 139 140* Fixed a potential panic due to an off-by-one error in the `Arbitrary` 141 implementation for `std::ops::Bound<T>`. 142 143-------------------------------------------------------------------------------- 144 145## 1.1.5 146 147Released 2022-09-08. 148 149### Added 150 151* Implemented `Arbitrary` for `std::ops::Bound<T>`. 152 153### Fixed 154 155* Fixed a bug where `Unstructured::int_in_range` could return out-of-range 156 integers when generating arbitrary signed integers. 157 158-------------------------------------------------------------------------------- 159 160## 1.1.4 161 162Released 2022-08-29. 163 164### Added 165 166* Implemented `Arbitrary` for `Rc<str>` and `Arc<str>` 167 168### Changed 169 170* Allow overriding the error type in `arbitrary::Result` 171* The `Unstructured::arbitrary_loop` method will consume fewer bytes of input 172 now. 173 174### Fixed 175 176* Fixed a bug where `Unstructured::int_in_range` could return out-of-range 177 integers. 178 179-------------------------------------------------------------------------------- 180 181## 1.1.3 182 183Released 2022-06-23. 184 185### Fixed 186 187* Fixed some potential (but highly unlikely) name-clashes inside 188 `derive(Arbitrary)`'s generated 189 code. [#111](https://github.com/rust-fuzz/arbitrary/pull/111) 190* Fixed an edge case where `derive(Arbitrary)` for recursive types that detected 191 an overflow would not reset the overflow 192 detection. [#111](https://github.com/rust-fuzz/arbitrary/pull/111) 193 194-------------------------------------------------------------------------------- 195 196## 1.1.2 197 198Released 2022-06-16. 199 200### Fixed 201 202* Fixed a warning inside `derive(Arbitrary)`-generated 203 code. [#110](https://github.com/rust-fuzz/arbitrary/pull/110) 204 205-------------------------------------------------------------------------------- 206 207## 1.1.1 208 209Released 2022-06-14. 210 211### Fixed 212 213* Fixed a stack overflow when using `derive(Arbitrary)` with recursive types and 214 empty inputs. [#109](https://github.com/rust-fuzz/arbitrary/pull/109) 215 216-------------------------------------------------------------------------------- 217 218## 1.1.0 219 220Released 2022-02-09. 221 222### Added 223 224* Added the `Unstructured::ratio` method to generate a boolean that is `true` at 225 the given rate. 226 227* Added the `Unstructured::arbitrary_loop` method to call a function an 228 arbitrary number of times. 229 230-------------------------------------------------------------------------------- 231 232## 1.0.3 233 234Released 2021-11-20. 235 236### Fixed 237 238* Fixed documentation for `Unstructured::fill_bytes`. We forgot to update this 239 way back in [#53](https://github.com/rust-fuzz/arbitrary/pull/53) when the 240 behavior changed. 241 242-------------------------------------------------------------------------------- 243 244## 1.0.2 245 246Released 2021-08-25. 247 248### Added 249 250* `Arbitrary` impls for `HashMap`s and `HashSet`s with custom `Hasher`s 251 [#87](https://github.com/rust-fuzz/arbitrary/pull/87) 252 253-------------------------------------------------------------------------------- 254 255## 1.0.1 256 257Released 2021-05-20. 258 259### Added 260 261* `Arbitrary` impls for `NonZeroX` types [#79](https://github.com/rust-fuzz/arbitrary/pull/79) 262* `Arbitrary` impls for all arrays using const generics [#55](https://github.com/rust-fuzz/arbitrary/pull/55) 263* `Arbitrary` impls for `Ipv4Addr` and `Ipv6Addr` [#84](https://github.com/rust-fuzz/arbitrary/pull/84) 264 265### Fixed 266 267* Use fewer bytes for `Unstructured::int_in_range()` [#80](https://github.com/rust-fuzz/arbitrary/pull/80) 268* Use correct range for `char` generation [#83](https://github.com/rust-fuzz/arbitrary/pull/83) 269 270-------------------------------------------------------------------------------- 271 272## 1.0.0 273 274Released 2020-02-24. 275 276See 1.0.0-rc1 and 1.0.0-rc2 for changes since 0.4.7, which was the last main 277line release. 278 279-------------------------------------------------------------------------------- 280 281## 1.0.0-rc2 282 283Released 2021-02-09. 284 285### Added 286 287* The `Arbitrary` trait is now implemented for `&[u8]`. [#67](https://github.com/rust-fuzz/arbitrary/pull/67) 288 289### Changed 290 291* Rename `Unstructured#get_bytes` to `Unstructured#bytes`. [#70](https://github.com/rust-fuzz/arbitrary/pull/70) 292* Passing an empty slice of choices to `Unstructured#choose` returns an error. Previously it would panic. [71](https://github.com/rust-fuzz/arbitrary/pull/71) 293 294-------------------------------------------------------------------------------- 295 296## 1.0.0-rc1 297 298Released 2020-11-25. 299 300### Added 301 302* The `Arbitrary` trait is now implemented for `&str`. [#63](https://github.com/rust-fuzz/arbitrary/pull/63) 303 304### Changed 305 306* The `Arbitrary` trait now has a lifetime parameter, allowing `Arbitrary` implementations that borrow from the raw input (e.g. the new `&str` implementaton). The `derive(Arbitrary)` macro also supports deriving `Arbitrary` on types with lifetimes now. [#63](https://github.com/rust-fuzz/arbitrary/pull/63) 307 308### Removed 309 310* The `shrink` method on the `Arbitrary` trait has been removed. 311 312 We have found that, in practice, using [internal reduction](https://drmaciver.github.io/papers/reduction-via-generation-preview.pdf) via approaches like `cargo fuzz tmin`, where the raw input bytes are reduced rather than the `T: Arbitrary` type constructed from those raw bytes, has the best efficiency-to-maintenance ratio. To the best of our knowledge, no one is relying on or using the `Arbitrary::shrink` method. If you *are* using and relying on the `Arbitrary::shrink` method, please reach out by [dropping a comment here](https://github.com/rust-fuzz/arbitrary/issues/62) and explaining how you're using it and what your use case is. We'll figure out what the best solution is, including potentially adding shrinking functionality back to the `arbitrary` crate. 313 314-------------------------------------------------------------------------------- 315 316## 0.4.7 317 318Released 2020-10-14. 319 320### Added 321 322* Added an optimization to avoid unnecessarily consuming bytes from the 323 underlying data when there is only one possible choice in 324 `Unstructured::{int_in_range, choose, etc..}`. 325 326* Added license files to the derive crate. 327 328### Changed 329 330* The `Arbitrary` implementation for `std::time::Duration` should now be faster 331 and produce durations with a more-uniform distribution of nanoseconds. 332 333-------------------------------------------------------------------------------- 334 335## 0.4.6 336 337Released 2020-08-22. 338 339### Added 340 341* Added the `Unstructured::peek_bytes` method. 342 343### Changed 344 345* Test case reduction via `cargo fuzz tmin` should be much more effective at 346 reducing the sizes of collections now. (See 347 [#53](https://github.com/rust-fuzz/arbitrary/pull/53) and the commit messages 348 for details.) 349 350* Fuzzing with mutation-based fuzzers (like libFuzzer) should be more efficient 351 now. (See [#53](https://github.com/rust-fuzz/arbitrary/pull/53) and the commit 352 messages for details) 353 354-------------------------------------------------------------------------------- 355 356## 0.4.5 357 358Released 2020-06-18. 359 360### Added 361 362* Implement `Arbitrary` for zero length arrays. 363* Implement `Arbitrary` for `Range` and `RangeInclusive`. 364 365-------------------------------------------------------------------------------- 366 367## 0.4.4 368 369Released 2020-04-29. 370 371### Fixed 372 373* Fixed the custom derive for enums when used via its full path (like 374 `#[derive(arbitrary::Arbitrary)]` rather than like `#[derive(Arbitrary)]`). 375 376 377## 0.4.3 378 379Released 2020-04-28. 380 381### Fixed 382 383* Fixed the custom derive when used via its full path (like 384 `#[derive(arbitrary::Arbitrary)]` rather than like `#[derive(Arbitrary)]`). 385 386-------------------------------------------------------------------------------- 387 388## 0.4.2 389 390Released 2020-04-17. 391 392### Changed 393 394* We forgot to release a new version of the `derive_arbitrary` crate last 395 release. This release fixes that and so the `synstructure` dependency is 396 finally actually removed in the cargo releases. 397 398-------------------------------------------------------------------------------- 399 400## 0.4.1 401 402Released 2020-03-18. 403 404### Removed 405 406* Removed an internal dependency on the `synstructure` crate when the `derive` 407 feature is enabled. This should not have any visible downstream effects other 408 than faster build times! 409 410-------------------------------------------------------------------------------- 411 412## 0.4.0 413 414Released 2020-01-22. 415 416This is technically a breaking change, but we expect that nearly everyone should 417be able to upgrade without any compilation errors. The only exception is if you 418were implementing the `Arbitrary::size_hint` method by hand. If so, see the 419"changed" section below and the [API docs for 420`Arbitrary::shrink`](https://docs.rs/arbitrary/0.4.0/arbitrary/trait.Arbitrary.html#method.size_hint) 421for details. 422 423### Added 424 425* Added [the `arbitary::size_hint::recursion_guard` helper 426 function][recursion_guard] for guarding against infinite recursion in 427 `size_hint` implementations for recursive types. 428 429### Changed 430 431* The `Arbitrary::size_hint` signature now takes a `depth: usize` 432 parameter. This should be passed along unmodified to any nested calls of other 433 `size_hint` methods. If you're implementing `size_hint` for a recursive type 434 (like a linked list or tree) or a generic type with type parameters, you 435 should use [the new `arbitrary::size_hint::recursion_guard` helper 436 function][recursion_guard]. 437 438### Fixed 439 440* Fixed infinite recursion in generated `size_hint` implementations 441 from `#[derive(Arbitrary)]` for recursive types. 442 443[recursion_guard]: https://docs.rs/arbitrary/0.4.0/arbitrary/size_hint/fn.recursion_guard.html 444 445-------------------------------------------------------------------------------- 446 447## 0.3.2 448 449Released 2020-01-16. 450 451### Changed 452 453* Updated the custom derive's dependencies. 454 455-------------------------------------------------------------------------------- 456 457## 0.3.2 458 459Released 2020-01-15. 460 461### Fixed 462 463* Fixed an over-eager assertion condition in `Unstructured::int_in_range` that 464 would incorrectly trigger when given valid ranges of length one. 465 466-------------------------------------------------------------------------------- 467 468## 0.3.1 469 470Released 2020-01-14. 471 472### Fixed 473 474* Fixed some links and version numbers in README. 475 476-------------------------------------------------------------------------------- 477 478## 0.3.0 479 480Released 2020-01-14. 481 482### Added 483 484* Added the `"derive"` cargo feature, to enable `#[derive(Arbitrary)]` for 485 custom types. Enabling this feature re-exports functionality from the 486 `derive_arbitrary` crate. 487* The custom derive for `Arbitrary` implements the shrink method for you now. 488* All implementations of `Arbitrary` for `std` types implement shrinking now. 489* Added the `Arbitrary::arbitrary_take_rest` method allows an `Arbitrary` 490 implementation to consume all of the rest of the remaining raw input. It has a 491 default implementation that forwards to `Arbitrary::arbitrary` and the custom 492 derive creates a smart implementation for your custom types. 493* Added the `Arbitrary::size_hint` method for hinting how many raw bytes an 494 implementation needs to construct itself. This has a default implementation, 495 but the custom derive creates a smart implementation for your custom types. 496* Added the `Unstructured::choose` method to choose one thing among a set of 497 choices. 498* Added the `Unstructured::arbitrary_len` method to get an arbitrary length for 499 a collection of some arbitrary type. 500* Added the `Unstructured::arbitrary_iter` method to create an iterator of 501 arbitrary instance of some type. 502 503### Changed 504 505* The `Arbitrary` trait was simplified a bit. 506* `Unstructured` is a concrete type now, not a trait. 507* Switched to Rust 2018 edition. 508 509### Removed 510 511* `RingBuffer` and `FiniteBuffer` are removed. Use `Unstructured` instead. 512 513### Fixed 514 515* Better `Arbitrary` implementation for `char`. 516* Better `Arbitrary` implementation for `String`. 517 518-------------------------------------------------------------------------------- 519 520## 0.2.0 521 522-------------------------------------------------------------------------------- 523 524## 0.1.0 525