/rust/registry/src/index.crates.io-1949cf8c6b5b557f/arbitrary-1.4.2/src/lib.rs
Line | Count | Source |
1 | | // Copyright © 2019 The Rust Fuzz Project Developers. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
4 | | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
5 | | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
6 | | // option. This file may not be copied, modified, or distributed |
7 | | // except according to those terms. |
8 | | |
9 | | //! The `Arbitrary` trait crate. |
10 | | //! |
11 | | //! This trait provides an [`Arbitrary`] trait to |
12 | | //! produce well-typed, structured values, from raw, byte buffers. It is |
13 | | //! generally intended to be used with fuzzers like AFL or libFuzzer. See the |
14 | | //! [`Arbitrary`] trait's documentation for details on |
15 | | //! automatically deriving, implementing, and/or using the trait. |
16 | | |
17 | | #![deny(bad_style)] |
18 | | #![deny(missing_docs)] |
19 | | #![deny(future_incompatible)] |
20 | | #![deny(nonstandard_style)] |
21 | | #![deny(rust_2018_compatibility)] |
22 | | #![deny(rust_2018_idioms)] |
23 | | #![deny(unused)] |
24 | | |
25 | | mod error; |
26 | | mod foreign; |
27 | | pub mod size_hint; |
28 | | pub mod unstructured; |
29 | | |
30 | | #[cfg(test)] |
31 | | mod tests; |
32 | | |
33 | | pub use error::*; |
34 | | |
35 | | #[cfg(feature = "derive_arbitrary")] |
36 | | pub use derive_arbitrary::*; |
37 | | |
38 | | #[doc(inline)] |
39 | | pub use unstructured::Unstructured; |
40 | | |
41 | | /// Error indicating that the maximum recursion depth has been reached while calculating [`Arbitrary::size_hint`]() |
42 | | #[derive(Debug, Clone)] |
43 | | #[non_exhaustive] |
44 | | pub struct MaxRecursionReached {} |
45 | | |
46 | | impl core::fmt::Display for MaxRecursionReached { |
47 | 0 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
48 | 0 | f.write_str("Maximum recursion depth has been reached") |
49 | 0 | } |
50 | | } |
51 | | |
52 | | impl std::error::Error for MaxRecursionReached {} |
53 | | |
54 | | /// Generate arbitrary structured values from raw, unstructured data. |
55 | | /// |
56 | | /// The `Arbitrary` trait allows you to generate valid structured values, like |
57 | | /// `HashMap`s, or ASTs, or `MyTomlConfig`, or any other data structure from |
58 | | /// raw, unstructured bytes provided by a fuzzer. |
59 | | /// |
60 | | /// # Deriving `Arbitrary` |
61 | | /// |
62 | | /// Automatically deriving the `Arbitrary` trait is the recommended way to |
63 | | /// implement `Arbitrary` for your types. |
64 | | /// |
65 | | /// Using the custom derive requires that you enable the `"derive"` cargo |
66 | | /// feature in your `Cargo.toml`: |
67 | | /// |
68 | | /// ```toml |
69 | | /// [dependencies] |
70 | | /// arbitrary = { version = "1", features = ["derive"] } |
71 | | /// ``` |
72 | | /// |
73 | | /// Then, you add the `#[derive(Arbitrary)]` annotation to your `struct` or |
74 | | /// `enum` type definition: |
75 | | /// |
76 | | /// ``` |
77 | | /// # #[cfg(feature = "derive")] mod foo { |
78 | | /// use arbitrary::Arbitrary; |
79 | | /// use std::collections::HashSet; |
80 | | /// |
81 | | /// #[derive(Arbitrary)] |
82 | | /// pub struct AddressBook { |
83 | | /// friends: HashSet<Friend>, |
84 | | /// } |
85 | | /// |
86 | | /// #[derive(Arbitrary, Hash, Eq, PartialEq)] |
87 | | /// pub enum Friend { |
88 | | /// Buddy { name: String }, |
89 | | /// Pal { age: usize }, |
90 | | /// } |
91 | | /// # } |
92 | | /// ``` |
93 | | /// |
94 | | /// Every member of the `struct` or `enum` must also implement `Arbitrary`. |
95 | | /// |
96 | | /// It is also possible to change the default bounds added by the derive: |
97 | | /// |
98 | | /// ``` |
99 | | /// # #[cfg(feature = "derive")] mod foo { |
100 | | /// use arbitrary::Arbitrary; |
101 | | /// |
102 | | /// trait Trait { |
103 | | /// type Assoc: for<'a> Arbitrary<'a>; |
104 | | /// } |
105 | | /// |
106 | | /// #[derive(Arbitrary)] |
107 | | /// // The bounds are used verbatim, so any existing trait bounds will need to be repeated. |
108 | | /// #[arbitrary(bound = "T: Trait")] |
109 | | /// struct Point<T: Trait> { |
110 | | /// x: T::Assoc, |
111 | | /// } |
112 | | /// # } |
113 | | /// ``` |
114 | | /// |
115 | | /// # Implementing `Arbitrary` By Hand |
116 | | /// |
117 | | /// Implementing `Arbitrary` mostly involves nested calls to other `Arbitrary` |
118 | | /// arbitrary implementations for each of your `struct` or `enum`'s members. But |
119 | | /// sometimes you need some amount of raw data, or you need to generate a |
120 | | /// variably-sized collection type, or something of that sort. The |
121 | | /// [`Unstructured`] type helps you with these tasks. |
122 | | /// |
123 | | /// ``` |
124 | | /// # #[cfg(feature = "derive")] mod foo { |
125 | | /// # pub struct MyCollection<T> { _t: std::marker::PhantomData<T> } |
126 | | /// # impl<T> MyCollection<T> { |
127 | | /// # pub fn new() -> Self { MyCollection { _t: std::marker::PhantomData } } |
128 | | /// # pub fn insert(&mut self, element: T) {} |
129 | | /// # } |
130 | | /// use arbitrary::{Arbitrary, Result, Unstructured}; |
131 | | /// |
132 | | /// impl<'a, T> Arbitrary<'a> for MyCollection<T> |
133 | | /// where |
134 | | /// T: Arbitrary<'a>, |
135 | | /// { |
136 | | /// fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> { |
137 | | /// // Get an iterator of arbitrary `T`s. |
138 | | /// let iter = u.arbitrary_iter::<T>()?; |
139 | | /// |
140 | | /// // And then create a collection! |
141 | | /// let mut my_collection = MyCollection::new(); |
142 | | /// for elem_result in iter { |
143 | | /// let elem = elem_result?; |
144 | | /// my_collection.insert(elem); |
145 | | /// } |
146 | | /// |
147 | | /// Ok(my_collection) |
148 | | /// } |
149 | | /// } |
150 | | /// # } |
151 | | /// ``` |
152 | | /// |
153 | | /// # A Note On Output Distributions |
154 | | /// |
155 | | /// There is no requirement for a particular distribution of the values. For |
156 | | /// example, it is not required that every value appears with the same |
157 | | /// probability. That being said, the main use for `Arbitrary` is for fuzzing, |
158 | | /// so in many cases a uniform distribution will make the most sense in order to |
159 | | /// provide the best coverage of the domain. In other cases this is not |
160 | | /// desirable or even possible, for example when sampling from a uniform |
161 | | /// distribution is computationally expensive or in the case of collections that |
162 | | /// may grow indefinitely. |
163 | | pub trait Arbitrary<'a>: Sized { |
164 | | /// Generate an arbitrary value of `Self` from the given unstructured data. |
165 | | /// |
166 | | /// Calling `Arbitrary::arbitrary` requires that you have some raw data, |
167 | | /// perhaps given to you by a fuzzer like AFL or libFuzzer. You wrap this |
168 | | /// raw data in an `Unstructured`, and then you can call `<MyType as |
169 | | /// Arbitrary>::arbitrary` to construct an arbitrary instance of `MyType` |
170 | | /// from that unstructured data. |
171 | | /// |
172 | | /// Implementations may return an error if there is not enough data to |
173 | | /// construct a full instance of `Self`, or they may fill out the rest of |
174 | | /// `Self` with dummy values. Using dummy values when the underlying data is |
175 | | /// exhausted can help avoid accidentally "defeating" some of the fuzzer's |
176 | | /// mutations to the underlying byte stream that might otherwise lead to |
177 | | /// interesting runtime behavior or new code coverage if only we had just a |
178 | | /// few more bytes. However, it also requires that implementations for |
179 | | /// recursive types (e.g. `struct Foo(Option<Box<Foo>>)`) avoid infinite |
180 | | /// recursion when the underlying data is exhausted. |
181 | | /// |
182 | | /// ``` |
183 | | /// # #[cfg(feature = "derive")] fn foo() { |
184 | | /// use arbitrary::{Arbitrary, Unstructured}; |
185 | | /// |
186 | | /// #[derive(Arbitrary)] |
187 | | /// pub struct MyType { |
188 | | /// // ... |
189 | | /// } |
190 | | /// |
191 | | /// // Get the raw data from the fuzzer or wherever else. |
192 | | /// # let get_raw_data_from_fuzzer = || &[]; |
193 | | /// let raw_data: &[u8] = get_raw_data_from_fuzzer(); |
194 | | /// |
195 | | /// // Wrap that raw data in an `Unstructured`. |
196 | | /// let mut unstructured = Unstructured::new(raw_data); |
197 | | /// |
198 | | /// // Generate an arbitrary instance of `MyType` and do stuff with it. |
199 | | /// if let Ok(value) = MyType::arbitrary(&mut unstructured) { |
200 | | /// # let do_stuff = |_| {}; |
201 | | /// do_stuff(value); |
202 | | /// } |
203 | | /// # } |
204 | | /// ``` |
205 | | /// |
206 | | /// See also the documentation for [`Unstructured`]. |
207 | | fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>; |
208 | | |
209 | | /// Generate an arbitrary value of `Self` from the entirety of the given |
210 | | /// unstructured data. |
211 | | /// |
212 | | /// This is similar to Arbitrary::arbitrary, however it assumes that it is |
213 | | /// the last consumer of the given data, and is thus able to consume it all |
214 | | /// if it needs. See also the documentation for |
215 | | /// [`Unstructured`]. |
216 | 52.6k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { |
217 | 52.6k | Self::arbitrary(&mut u) |
218 | 52.6k | } Unexecuted instantiation: <bool as arbitrary::Arbitrary>::arbitrary_take_rest Unexecuted instantiation: <char as arbitrary::Arbitrary>::arbitrary_take_rest Unexecuted instantiation: <usize as arbitrary::Arbitrary>::arbitrary_take_rest Unexecuted instantiation: <u32 as arbitrary::Arbitrary>::arbitrary_take_rest <alloc::boxed::Box<regex_syntax::ast::Repetition> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 2.11k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 2.11k | Self::arbitrary(&mut u) | 218 | 2.11k | } |
<alloc::boxed::Box<regex_syntax::ast::Alternation> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 3.96k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 3.96k | Self::arbitrary(&mut u) | 218 | 3.96k | } |
<alloc::boxed::Box<regex_syntax::ast::ClassUnicode> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 699 | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 699 | Self::arbitrary(&mut u) | 218 | 699 | } |
<alloc::boxed::Box<regex_syntax::ast::ClassBracketed> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 4.25k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 4.25k | Self::arbitrary(&mut u) | 218 | 4.25k | } |
Unexecuted instantiation: <alloc::boxed::Box<regex_syntax::ast::Ast> as arbitrary::Arbitrary>::arbitrary_take_rest <alloc::boxed::Box<regex_syntax::ast::Span> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 119 | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 119 | Self::arbitrary(&mut u) | 218 | 119 | } |
<alloc::boxed::Box<regex_syntax::ast::Group> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 5.08k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 5.08k | Self::arbitrary(&mut u) | 218 | 5.08k | } |
<alloc::boxed::Box<regex_syntax::ast::Concat> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 7.54k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 7.54k | Self::arbitrary(&mut u) | 218 | 7.54k | } |
<alloc::boxed::Box<regex_syntax::ast::Literal> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 547 | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 547 | Self::arbitrary(&mut u) | 218 | 547 | } |
Unexecuted instantiation: <alloc::boxed::Box<regex_syntax::ast::ClassSet> as arbitrary::Arbitrary>::arbitrary_take_rest <alloc::boxed::Box<regex_syntax::ast::SetFlags> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 360 | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 360 | Self::arbitrary(&mut u) | 218 | 360 | } |
<alloc::boxed::Box<regex_syntax::ast::Assertion> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 52 | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 52 | Self::arbitrary(&mut u) | 218 | 52 | } |
<alloc::boxed::Box<regex_syntax::ast::ClassPerl> as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 62 | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 62 | Self::arbitrary(&mut u) | 218 | 62 | } |
Unexecuted instantiation: <regex_syntax::ast::CaptureName as arbitrary::Arbitrary>::arbitrary_take_rest Unexecuted instantiation: <regex_syntax::ast::ClassUnicodeKind as arbitrary::Arbitrary>::arbitrary_take_rest Unexecuted instantiation: <_ as arbitrary::Arbitrary>::arbitrary_take_rest <bool as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 8.11k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 8.11k | Self::arbitrary(&mut u) | 218 | 8.11k | } |
<bool as arbitrary::Arbitrary>::arbitrary_take_rest Line | Count | Source | 216 | 19.7k | fn arbitrary_take_rest(mut u: Unstructured<'a>) -> Result<Self> { | 217 | 19.7k | Self::arbitrary(&mut u) | 218 | 19.7k | } |
|
219 | | |
220 | | /// Get a size hint for how many bytes out of an `Unstructured` this type |
221 | | /// needs to construct itself. |
222 | | /// |
223 | | /// This is useful for determining how many elements we should insert when |
224 | | /// creating an arbitrary collection. |
225 | | /// |
226 | | /// The return value is similar to [`Iterator::size_hint`]: it returns a |
227 | | /// tuple where the first element is a lower bound on the number of bytes |
228 | | /// required, and the second element is an optional upper bound. |
229 | | /// |
230 | | /// The default implementation return `(0, None)` which is correct for any |
231 | | /// type, but not ultimately that useful. Using `#[derive(Arbitrary)]` will |
232 | | /// create a better implementation. If you are writing an `Arbitrary` |
233 | | /// implementation by hand, and your type can be part of a dynamically sized |
234 | | /// collection (such as `Vec`), you are strongly encouraged to override this |
235 | | /// default with a better implementation, and also override |
236 | | /// [`try_size_hint`]. |
237 | | /// |
238 | | /// ## How to implement this |
239 | | /// |
240 | | /// If the size hint calculation is a trivial constant and does not recurse |
241 | | /// into any other `size_hint` call, you should implement it in `size_hint`: |
242 | | /// |
243 | | /// ``` |
244 | | /// use arbitrary::{size_hint, Arbitrary, Result, Unstructured}; |
245 | | /// |
246 | | /// struct SomeStruct(u8); |
247 | | /// |
248 | | /// impl<'a> Arbitrary<'a> for SomeStruct { |
249 | | /// fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> { |
250 | | /// let buf = &mut [0]; |
251 | | /// u.fill_buffer(buf)?; |
252 | | /// Ok(SomeStruct(buf[0])) |
253 | | /// } |
254 | | /// |
255 | | /// #[inline] |
256 | | /// fn size_hint(depth: usize) -> (usize, Option<usize>) { |
257 | | /// let _ = depth; |
258 | | /// (1, Some(1)) |
259 | | /// } |
260 | | /// } |
261 | | /// ``` |
262 | | /// |
263 | | /// Otherwise, it should instead be implemented in [`try_size_hint`], |
264 | | /// and the `size_hint` implementation should forward to it: |
265 | | /// |
266 | | /// ``` |
267 | | /// use arbitrary::{size_hint, Arbitrary, MaxRecursionReached, Result, Unstructured}; |
268 | | /// |
269 | | /// struct SomeStruct<A, B> { |
270 | | /// a: A, |
271 | | /// b: B, |
272 | | /// } |
273 | | /// |
274 | | /// impl<'a, A: Arbitrary<'a>, B: Arbitrary<'a>> Arbitrary<'a> for SomeStruct<A, B> { |
275 | | /// fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> { |
276 | | /// // ... |
277 | | /// # todo!() |
278 | | /// } |
279 | | /// |
280 | | /// fn size_hint(depth: usize) -> (usize, Option<usize>) { |
281 | | /// // Return the value of try_size_hint |
282 | | /// // |
283 | | /// // If the recursion fails, return the default, always valid `(0, None)` |
284 | | /// Self::try_size_hint(depth).unwrap_or_default() |
285 | | /// } |
286 | | /// |
287 | | /// fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { |
288 | | /// // Protect against potential infinite recursion with |
289 | | /// // `try_recursion_guard`. |
290 | | /// size_hint::try_recursion_guard(depth, |depth| { |
291 | | /// // If we aren't too deep, then `recursion_guard` calls |
292 | | /// // this closure, which implements the natural size hint. |
293 | | /// // Don't forget to use the new `depth` in all nested |
294 | | /// // `try_size_hint` calls! We recommend shadowing the |
295 | | /// // parameter, like what is done here, so that you can't |
296 | | /// // accidentally use the wrong depth. |
297 | | /// Ok(size_hint::and( |
298 | | /// <A as Arbitrary>::try_size_hint(depth)?, |
299 | | /// <B as Arbitrary>::try_size_hint(depth)?, |
300 | | /// )) |
301 | | /// }) |
302 | | /// } |
303 | | /// } |
304 | | /// ``` |
305 | | /// |
306 | | /// ## Invariant |
307 | | /// |
308 | | /// It must be possible to construct every possible output using only inputs |
309 | | /// of lengths bounded by these parameters. This applies to both |
310 | | /// [`Arbitrary::arbitrary`] and [`Arbitrary::arbitrary_take_rest`]. |
311 | | /// |
312 | | /// This is trivially true for `(0, None)`. To restrict this further, it |
313 | | /// must be proven that all inputs that are now excluded produced redundant |
314 | | /// outputs which are still possible to produce using the reduced input |
315 | | /// space. |
316 | | /// |
317 | | /// [iterator-size-hint]: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.size_hint |
318 | | /// [`try_size_hint`]: Arbitrary::try_size_hint |
319 | | #[inline] |
320 | 0 | fn size_hint(depth: usize) -> (usize, Option<usize>) { |
321 | 0 | let _ = depth; |
322 | 0 | (0, None) |
323 | 0 | } |
324 | | |
325 | | /// Get a size hint for how many bytes out of an `Unstructured` this type |
326 | | /// needs to construct itself. |
327 | | /// |
328 | | /// Unlike [`size_hint`], this function keeps the information that the |
329 | | /// recursion limit was reached. This is required to "short circuit" the |
330 | | /// calculation and avoid exponential blowup with recursive structures. |
331 | | /// |
332 | | /// If you are implementing [`size_hint`] for a struct that could be |
333 | | /// recursive, you should implement `try_size_hint` and call the |
334 | | /// `try_size_hint` when recursing |
335 | | /// |
336 | | /// |
337 | | /// The return value is similar to [`core::iter::Iterator::size_hint`]: it |
338 | | /// returns a tuple where the first element is a lower bound on the number |
339 | | /// of bytes required, and the second element is an optional upper bound. |
340 | | /// |
341 | | /// The default implementation returns the value of [`size_hint`] which is |
342 | | /// correct for any type, but might lead to exponential blowup when dealing |
343 | | /// with recursive types. |
344 | | /// |
345 | | /// ## Invariant |
346 | | /// |
347 | | /// It must be possible to construct every possible output using only inputs |
348 | | /// of lengths bounded by these parameters. This applies to both |
349 | | /// [`Arbitrary::arbitrary`] and [`Arbitrary::arbitrary_take_rest`]. |
350 | | /// |
351 | | /// This is trivially true for `(0, None)`. To restrict this further, it |
352 | | /// must be proven that all inputs that are now excluded produced redundant |
353 | | /// outputs which are still possible to produce using the reduced input |
354 | | /// space. |
355 | | /// |
356 | | /// ## When to implement `try_size_hint` |
357 | | /// |
358 | | /// If you 100% know that the type you are implementing `Arbitrary` for is |
359 | | /// not a recursive type, or your implementation is not transitively calling |
360 | | /// any other `size_hint` methods, you may implement [`size_hint`], and the |
361 | | /// default `try_size_hint` implementation will use it. |
362 | | /// |
363 | | /// Note that if you are implementing `Arbitrary` for a generic type, you |
364 | | /// cannot guarantee the lack of type recursion! |
365 | | /// |
366 | | /// Otherwise, when there is possible type recursion, you should implement |
367 | | /// `try_size_hint` instead. |
368 | | /// |
369 | | /// ## The `depth` parameter |
370 | | /// |
371 | | /// When implementing `try_size_hint`, you need to use |
372 | | /// [`arbitrary::size_hint::try_recursion_guard(depth)`][crate::size_hint::try_recursion_guard] |
373 | | /// to prevent potential infinite recursion when calculating size hints for |
374 | | /// potentially recursive types: |
375 | | /// |
376 | | /// ``` |
377 | | /// use arbitrary::{size_hint, Arbitrary, MaxRecursionReached, Unstructured}; |
378 | | /// |
379 | | /// // This can potentially be a recursive type if `L` or `R` contain |
380 | | /// // something like `Box<Option<MyEither<L, R>>>`! |
381 | | /// enum MyEither<L, R> { |
382 | | /// Left(L), |
383 | | /// Right(R), |
384 | | /// } |
385 | | /// |
386 | | /// impl<'a, L, R> Arbitrary<'a> for MyEither<L, R> |
387 | | /// where |
388 | | /// L: Arbitrary<'a>, |
389 | | /// R: Arbitrary<'a>, |
390 | | /// { |
391 | | /// fn arbitrary(u: &mut Unstructured) -> arbitrary::Result<Self> { |
392 | | /// // ... |
393 | | /// # unimplemented!() |
394 | | /// } |
395 | | /// |
396 | | /// fn size_hint(depth: usize) -> (usize, Option<usize>) { |
397 | | /// // Return the value of `try_size_hint` |
398 | | /// // |
399 | | /// // If the recursion fails, return the default `(0, None)` range, |
400 | | /// // which is always valid. |
401 | | /// Self::try_size_hint(depth).unwrap_or_default() |
402 | | /// } |
403 | | /// |
404 | | /// fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { |
405 | | /// // Protect against potential infinite recursion with |
406 | | /// // `try_recursion_guard`. |
407 | | /// size_hint::try_recursion_guard(depth, |depth| { |
408 | | /// // If we aren't too deep, then `recursion_guard` calls |
409 | | /// // this closure, which implements the natural size hint. |
410 | | /// // Don't forget to use the new `depth` in all nested |
411 | | /// // `try_size_hint` calls! We recommend shadowing the |
412 | | /// // parameter, like what is done here, so that you can't |
413 | | /// // accidentally use the wrong depth. |
414 | | /// Ok(size_hint::or( |
415 | | /// <L as Arbitrary>::try_size_hint(depth)?, |
416 | | /// <R as Arbitrary>::try_size_hint(depth)?, |
417 | | /// )) |
418 | | /// }) |
419 | | /// } |
420 | | /// } |
421 | | /// ``` |
422 | | #[inline] |
423 | 24.4M | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { |
424 | 24.4M | Ok(Self::size_hint(depth)) |
425 | 24.4M | } Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::ClassSetItem> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::Ast> as arbitrary::Arbitrary>::try_size_hint <alloc::vec::Vec<regex_syntax::ast::FlagsItem> as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 9.39k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 9.39k | Ok(Self::size_hint(depth)) | 425 | 9.39k | } |
Unexecuted instantiation: <regex_syntax::ast::CaptureName as arbitrary::Arbitrary>::try_size_hint <regex_syntax::ast::AssertionKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 9.39k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 9.39k | Ok(Self::size_hint(depth)) | 425 | 9.39k | } |
<regex_syntax::ast::ClassPerlKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 37.5k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 37.5k | Ok(Self::size_hint(depth)) | 425 | 37.5k | } |
<regex_syntax::ast::ClassAsciiKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 28.1k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 28.1k | Ok(Self::size_hint(depth)) | 425 | 28.1k | } |
<regex_syntax::ast::HexLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 206k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 206k | Ok(Self::size_hint(depth)) | 425 | 206k | } |
<regex_syntax::ast::ClassUnicodeKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 37.5k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 37.5k | Ok(Self::size_hint(depth)) | 425 | 37.5k | } |
<regex_syntax::ast::SpecialLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 103k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 103k | Ok(Self::size_hint(depth)) | 425 | 103k | } |
Unexecuted instantiation: <regex_syntax::ast::ClassSetBinaryOpKind as arbitrary::Arbitrary>::try_size_hint <bool as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 140k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 140k | Ok(Self::size_hint(depth)) | 425 | 140k | } |
<char as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 103k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 103k | Ok(Self::size_hint(depth)) | 425 | 103k | } |
<usize as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 2.19M | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 2.19M | Ok(Self::size_hint(depth)) | 425 | 2.19M | } |
Unexecuted instantiation: <u32 as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::ClassSetItem> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::Ast> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::FlagsItem> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::CaptureName as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::AssertionKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::ClassPerlKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::ClassAsciiKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::HexLiteralKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::ClassUnicodeKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::SpecialLiteralKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::ClassSetBinaryOpKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::Flag as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <bool as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <char as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <usize as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <u32 as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <_ as arbitrary::Arbitrary>::try_size_hint <&str as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 16.2k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 16.2k | Ok(Self::size_hint(depth)) | 425 | 16.2k | } |
<bool as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 48.8k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 48.8k | Ok(Self::size_hint(depth)) | 425 | 48.8k | } |
Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::ClassSetItem> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::Ast> as arbitrary::Arbitrary>::try_size_hint <alloc::vec::Vec<regex_syntax::ast::FlagsItem> as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 15.4k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 15.4k | Ok(Self::size_hint(depth)) | 425 | 15.4k | } |
Unexecuted instantiation: <regex_syntax::ast::CaptureName as arbitrary::Arbitrary>::try_size_hint <regex_syntax::ast::AssertionKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 15.4k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 15.4k | Ok(Self::size_hint(depth)) | 425 | 15.4k | } |
<regex_syntax::ast::ClassPerlKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 61.6k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 61.6k | Ok(Self::size_hint(depth)) | 425 | 61.6k | } |
<regex_syntax::ast::ClassAsciiKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 46.2k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 46.2k | Ok(Self::size_hint(depth)) | 425 | 46.2k | } |
<regex_syntax::ast::HexLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 338k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 338k | Ok(Self::size_hint(depth)) | 425 | 338k | } |
<regex_syntax::ast::ClassUnicodeKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 61.6k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 61.6k | Ok(Self::size_hint(depth)) | 425 | 61.6k | } |
<regex_syntax::ast::SpecialLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 169k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 169k | Ok(Self::size_hint(depth)) | 425 | 169k | } |
Unexecuted instantiation: <regex_syntax::ast::ClassSetBinaryOpKind as arbitrary::Arbitrary>::try_size_hint <bool as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 231k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 231k | Ok(Self::size_hint(depth)) | 425 | 231k | } |
<char as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 169k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 169k | Ok(Self::size_hint(depth)) | 425 | 169k | } |
<usize as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 3.60M | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 3.60M | Ok(Self::size_hint(depth)) | 425 | 3.60M | } |
Unexecuted instantiation: <u32 as arbitrary::Arbitrary>::try_size_hint <&str as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 39.4k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 39.4k | Ok(Self::size_hint(depth)) | 425 | 39.4k | } |
<bool as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 138k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 138k | Ok(Self::size_hint(depth)) | 425 | 138k | } |
Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::ClassSetItem> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::Ast> as arbitrary::Arbitrary>::try_size_hint <alloc::vec::Vec<regex_syntax::ast::FlagsItem> as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 26.0k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 26.0k | Ok(Self::size_hint(depth)) | 425 | 26.0k | } |
Unexecuted instantiation: <alloc::vec::Vec<u8> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <regex_syntax::ast::CaptureName as arbitrary::Arbitrary>::try_size_hint <regex_syntax::ast::AssertionKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 26.0k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 26.0k | Ok(Self::size_hint(depth)) | 425 | 26.0k | } |
<regex_syntax::ast::ClassPerlKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 104k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 104k | Ok(Self::size_hint(depth)) | 425 | 104k | } |
<regex_syntax::ast::ClassAsciiKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 78.2k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 78.2k | Ok(Self::size_hint(depth)) | 425 | 78.2k | } |
<regex_syntax::ast::HexLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 574k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 574k | Ok(Self::size_hint(depth)) | 425 | 574k | } |
<regex_syntax::ast::ClassUnicodeKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 104k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 104k | Ok(Self::size_hint(depth)) | 425 | 104k | } |
<regex_syntax::ast::SpecialLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 287k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 287k | Ok(Self::size_hint(depth)) | 425 | 287k | } |
Unexecuted instantiation: <regex_syntax::ast::ClassSetBinaryOpKind as arbitrary::Arbitrary>::try_size_hint <bool as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 391k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 391k | Ok(Self::size_hint(depth)) | 425 | 391k | } |
<char as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 287k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 287k | Ok(Self::size_hint(depth)) | 425 | 287k | } |
<usize as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 6.10M | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 6.10M | Ok(Self::size_hint(depth)) | 425 | 6.10M | } |
Unexecuted instantiation: <u32 as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::ClassSetItem> as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::vec::Vec<regex_syntax::ast::Ast> as arbitrary::Arbitrary>::try_size_hint <alloc::vec::Vec<regex_syntax::ast::FlagsItem> as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 28.1k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 28.1k | Ok(Self::size_hint(depth)) | 425 | 28.1k | } |
Unexecuted instantiation: <regex_syntax::ast::CaptureName as arbitrary::Arbitrary>::try_size_hint <regex_syntax::ast::AssertionKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 28.1k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 28.1k | Ok(Self::size_hint(depth)) | 425 | 28.1k | } |
<regex_syntax::ast::ClassPerlKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 112k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 112k | Ok(Self::size_hint(depth)) | 425 | 112k | } |
<regex_syntax::ast::ClassAsciiKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 84.3k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 84.3k | Ok(Self::size_hint(depth)) | 425 | 84.3k | } |
<regex_syntax::ast::HexLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 618k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 618k | Ok(Self::size_hint(depth)) | 425 | 618k | } |
<regex_syntax::ast::ClassUnicodeKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 112k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 112k | Ok(Self::size_hint(depth)) | 425 | 112k | } |
<regex_syntax::ast::SpecialLiteralKind as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 309k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 309k | Ok(Self::size_hint(depth)) | 425 | 309k | } |
Unexecuted instantiation: <regex_syntax::ast::ClassSetBinaryOpKind as arbitrary::Arbitrary>::try_size_hint Unexecuted instantiation: <alloc::string::String as arbitrary::Arbitrary>::try_size_hint <bool as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 421k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 421k | Ok(Self::size_hint(depth)) | 425 | 421k | } |
<char as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 309k | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 309k | Ok(Self::size_hint(depth)) | 425 | 309k | } |
<usize as arbitrary::Arbitrary>::try_size_hint Line | Count | Source | 423 | 6.58M | fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), MaxRecursionReached> { | 424 | 6.58M | Ok(Self::size_hint(depth)) | 425 | 6.58M | } |
Unexecuted instantiation: <u32 as arbitrary::Arbitrary>::try_size_hint |
426 | | } |
427 | | |
428 | | #[cfg(test)] |
429 | | mod test { |
430 | | use super::*; |
431 | | |
432 | | #[test] |
433 | | fn exhausted_entropy() { |
434 | | let mut u = Unstructured::new(&[]); |
435 | | assert_eq!(u.arbitrary::<bool>().unwrap(), false); |
436 | | assert_eq!(u.arbitrary::<u8>().unwrap(), 0); |
437 | | assert_eq!(u.arbitrary::<usize>().unwrap(), 0); |
438 | | assert_eq!(u.arbitrary::<f32>().unwrap(), 0.0); |
439 | | assert_eq!(u.arbitrary::<f64>().unwrap(), 0.0); |
440 | | assert_eq!(u.arbitrary::<Option<u32>>().unwrap(), None); |
441 | | assert_eq!(u.int_in_range(4..=100).unwrap(), 4); |
442 | | assert_eq!(u.choose_index(10).unwrap(), 0); |
443 | | assert_eq!(u.ratio(5, 7).unwrap(), true); |
444 | | } |
445 | | } |
446 | | |
447 | | /// Multiple conflicting arbitrary attributes are used on the same field: |
448 | | /// ```compile_fail |
449 | | /// #[derive(::arbitrary::Arbitrary)] |
450 | | /// struct Point { |
451 | | /// #[arbitrary(value = 2)] |
452 | | /// #[arbitrary(value = 2)] |
453 | | /// x: i32, |
454 | | /// } |
455 | | /// ``` |
456 | | /// |
457 | | /// An unknown attribute: |
458 | | /// ```compile_fail |
459 | | /// #[derive(::arbitrary::Arbitrary)] |
460 | | /// struct Point { |
461 | | /// #[arbitrary(unknown_attr)] |
462 | | /// x: i32, |
463 | | /// } |
464 | | /// ``` |
465 | | /// |
466 | | /// An unknown attribute with a value: |
467 | | /// ```compile_fail |
468 | | /// #[derive(::arbitrary::Arbitrary)] |
469 | | /// struct Point { |
470 | | /// #[arbitrary(unknown_attr = 13)] |
471 | | /// x: i32, |
472 | | /// } |
473 | | /// ``` |
474 | | /// |
475 | | /// `value` without RHS: |
476 | | /// ```compile_fail |
477 | | /// #[derive(::arbitrary::Arbitrary)] |
478 | | /// struct Point { |
479 | | /// #[arbitrary(value)] |
480 | | /// x: i32, |
481 | | /// } |
482 | | /// ``` |
483 | | /// |
484 | | /// `with` without RHS: |
485 | | /// ```compile_fail |
486 | | /// #[derive(::arbitrary::Arbitrary)] |
487 | | /// struct Point { |
488 | | /// #[arbitrary(with)] |
489 | | /// x: i32, |
490 | | /// } |
491 | | /// ``` |
492 | | /// |
493 | | /// Multiple conflicting bounds at the container-level: |
494 | | /// ```compile_fail |
495 | | /// #[derive(::arbitrary::Arbitrary)] |
496 | | /// #[arbitrary(bound = "T: Default")] |
497 | | /// #[arbitrary(bound = "T: Default")] |
498 | | /// struct Point<T: Default> { |
499 | | /// #[arbitrary(default)] |
500 | | /// x: T, |
501 | | /// } |
502 | | /// ``` |
503 | | /// |
504 | | /// Multiple conflicting bounds in a single bound attribute: |
505 | | /// ```compile_fail |
506 | | /// #[derive(::arbitrary::Arbitrary)] |
507 | | /// #[arbitrary(bound = "T: Default, T: Default")] |
508 | | /// struct Point<T: Default> { |
509 | | /// #[arbitrary(default)] |
510 | | /// x: T, |
511 | | /// } |
512 | | /// ``` |
513 | | /// |
514 | | /// Multiple conflicting bounds in multiple bound attributes: |
515 | | /// ```compile_fail |
516 | | /// #[derive(::arbitrary::Arbitrary)] |
517 | | /// #[arbitrary(bound = "T: Default", bound = "T: Default")] |
518 | | /// struct Point<T: Default> { |
519 | | /// #[arbitrary(default)] |
520 | | /// x: T, |
521 | | /// } |
522 | | /// ``` |
523 | | /// |
524 | | /// Too many bounds supplied: |
525 | | /// ```compile_fail |
526 | | /// #[derive(::arbitrary::Arbitrary)] |
527 | | /// #[arbitrary(bound = "T: Default")] |
528 | | /// struct Point { |
529 | | /// x: i32, |
530 | | /// } |
531 | | /// ``` |
532 | | /// |
533 | | /// Too many bounds supplied across multiple attributes: |
534 | | /// ```compile_fail |
535 | | /// #[derive(::arbitrary::Arbitrary)] |
536 | | /// #[arbitrary(bound = "T: Default")] |
537 | | /// #[arbitrary(bound = "U: Default")] |
538 | | /// struct Point<T: Default> { |
539 | | /// #[arbitrary(default)] |
540 | | /// x: T, |
541 | | /// } |
542 | | /// ``` |
543 | | /// |
544 | | /// Attempt to use the derive attribute on an enum variant: |
545 | | /// ```compile_fail |
546 | | /// #[derive(::arbitrary::Arbitrary)] |
547 | | /// enum Enum<T: Default> { |
548 | | /// #[arbitrary(default)] |
549 | | /// Variant(T), |
550 | | /// } |
551 | | /// ``` |
552 | | #[cfg(all(doctest, feature = "derive"))] |
553 | | pub struct CompileFailTests; |
554 | | |
555 | | // Support for `#[derive(Arbitrary)]`. |
556 | | #[doc(hidden)] |
557 | | #[cfg(feature = "derive")] |
558 | | pub mod details { |
559 | | use super::*; |
560 | | |
561 | | // Hidden trait that papers over the difference between `&mut Unstructured` and |
562 | | // `Unstructured` arguments so that `with_recursive_count` can be used for both |
563 | | // `arbitrary` and `arbitrary_take_rest`. |
564 | | pub trait IsEmpty { |
565 | | fn is_empty(&self) -> bool; |
566 | | } |
567 | | |
568 | | impl IsEmpty for Unstructured<'_> { |
569 | 131k | fn is_empty(&self) -> bool { |
570 | 131k | Unstructured::is_empty(self) |
571 | 131k | } |
572 | | } |
573 | | |
574 | | impl IsEmpty for &mut Unstructured<'_> { |
575 | 14.3M | fn is_empty(&self) -> bool { |
576 | 14.3M | Unstructured::is_empty(self) |
577 | 14.3M | } |
578 | | } |
579 | | |
580 | | // Calls `f` with a recursive count guard. |
581 | | #[inline] |
582 | 14.5M | pub fn with_recursive_count<U: IsEmpty, R>( |
583 | 14.5M | u: U, |
584 | 14.5M | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, |
585 | 14.5M | f: impl FnOnce(U) -> Result<R>, |
586 | 14.5M | ) -> Result<R> { |
587 | 14.5M | let guard_against_recursion = u.is_empty(); |
588 | 14.5M | if guard_against_recursion { |
589 | 725k | recursive_count.with(|count| { |
590 | 725k | if count.get() > 0 { |
591 | 0 | return Err(Error::NotEnoughData); |
592 | 725k | } |
593 | 725k | count.set(count.get() + 1); |
594 | 725k | Ok(()) |
595 | 725k | })?; Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_roundtrip::FuzzData, <ast_roundtrip::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassAscii, <regex_syntax::ast::ClassAscii as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Repetition, <regex_syntax::ast::Repetition as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Alternation, <regex_syntax::ast::Alternation as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::LiteralKind, <regex_syntax::ast::LiteralKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetItem, <regex_syntax::ast::ClassSetItem as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassUnicode, <regex_syntax::ast::ClassUnicode as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionOp, <regex_syntax::ast::RepetitionOp as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::WithComments, <regex_syntax::ast::WithComments as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetRange, <regex_syntax::ast::ClassSetRange as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetUnion, <regex_syntax::ast::ClassSetUnion as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItemKind, <regex_syntax::ast::FlagsItemKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassBracketed, <regex_syntax::ast::ClassBracketed as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionKind, <regex_syntax::ast::RepetitionKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionRange, <regex_syntax::ast::RepetitionRange as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetBinaryOp, <regex_syntax::ast::ClassSetBinaryOp as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Ast, <regex_syntax::ast::Ast as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Span, <regex_syntax::ast::Span as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Error, <regex_syntax::ast::Error as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Flags, <regex_syntax::ast::Flags as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Group, <regex_syntax::ast::Group as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Concat, <regex_syntax::ast::Concat as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Comment, <regex_syntax::ast::Comment as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Literal, <regex_syntax::ast::Literal as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSet, <regex_syntax::ast::ClassSet as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Position, <regex_syntax::ast::Position as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::SetFlags, <regex_syntax::ast::SetFlags as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Assertion, <regex_syntax::ast::Assertion as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassPerl, <regex_syntax::ast::ClassPerl as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ErrorKind, <regex_syntax::ast::ErrorKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItem, <regex_syntax::ast::FlagsItem as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::GroupKind, <regex_syntax::ast::GroupKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassAscii, <regex_syntax::ast::ClassAscii as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 443 | recursive_count.with(|count| { | 590 | 443 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 443 | } | 593 | 443 | count.set(count.get() + 1); | 594 | 443 | Ok(()) | 595 | 443 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Repetition, <regex_syntax::ast::Repetition as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 381 | recursive_count.with(|count| { | 590 | 381 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 381 | } | 593 | 381 | count.set(count.get() + 1); | 594 | 381 | Ok(()) | 595 | 381 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Alternation, <regex_syntax::ast::Alternation as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 83 | recursive_count.with(|count| { | 590 | 83 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 83 | } | 593 | 83 | count.set(count.get() + 1); | 594 | 83 | Ok(()) | 595 | 83 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::LiteralKind, <regex_syntax::ast::LiteralKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 6.02k | recursive_count.with(|count| { | 590 | 6.02k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 6.02k | } | 593 | 6.02k | count.set(count.get() + 1); | 594 | 6.02k | Ok(()) | 595 | 6.02k | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetItem, <regex_syntax::ast::ClassSetItem as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 125k | recursive_count.with(|count| { | 590 | 125k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 125k | } | 593 | 125k | count.set(count.get() + 1); | 594 | 125k | Ok(()) | 595 | 125k | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassUnicode, <regex_syntax::ast::ClassUnicode as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 323 | recursive_count.with(|count| { | 590 | 323 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 323 | } | 593 | 323 | count.set(count.get() + 1); | 594 | 323 | Ok(()) | 595 | 323 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionOp, <regex_syntax::ast::RepetitionOp as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 1.40k | recursive_count.with(|count| { | 590 | 1.40k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 1.40k | } | 593 | 1.40k | count.set(count.get() + 1); | 594 | 1.40k | Ok(()) | 595 | 1.40k | })?; |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::WithComments, <regex_syntax::ast::WithComments as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetRange, <regex_syntax::ast::ClassSetRange as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 104 | recursive_count.with(|count| { | 590 | 104 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 104 | } | 593 | 104 | count.set(count.get() + 1); | 594 | 104 | Ok(()) | 595 | 104 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetUnion, <regex_syntax::ast::ClassSetUnion as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 70 | recursive_count.with(|count| { | 590 | 70 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 70 | } | 593 | 70 | count.set(count.get() + 1); | 594 | 70 | Ok(()) | 595 | 70 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItemKind, <regex_syntax::ast::FlagsItemKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 714 | recursive_count.with(|count| { | 590 | 714 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 714 | } | 593 | 714 | count.set(count.get() + 1); | 594 | 714 | Ok(()) | 595 | 714 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassBracketed, <regex_syntax::ast::ClassBracketed as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 516 | recursive_count.with(|count| { | 590 | 516 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 516 | } | 593 | 516 | count.set(count.get() + 1); | 594 | 516 | Ok(()) | 595 | 516 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionKind, <regex_syntax::ast::RepetitionKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 1.69k | recursive_count.with(|count| { | 590 | 1.69k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 1.69k | } | 593 | 1.69k | count.set(count.get() + 1); | 594 | 1.69k | Ok(()) | 595 | 1.69k | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionRange, <regex_syntax::ast::RepetitionRange as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 19 | recursive_count.with(|count| { | 590 | 19 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 19 | } | 593 | 19 | count.set(count.get() + 1); | 594 | 19 | Ok(()) | 595 | 19 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetBinaryOp, <regex_syntax::ast::ClassSetBinaryOp as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 790 | recursive_count.with(|count| { | 590 | 790 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 790 | } | 593 | 790 | count.set(count.get() + 1); | 594 | 790 | Ok(()) | 595 | 790 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Ast, <regex_syntax::ast::Ast as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 6.56k | recursive_count.with(|count| { | 590 | 6.56k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 6.56k | } | 593 | 6.56k | count.set(count.get() + 1); | 594 | 6.56k | Ok(()) | 595 | 6.56k | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Span, <regex_syntax::ast::Span as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 144k | recursive_count.with(|count| { | 590 | 144k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 144k | } | 593 | 144k | count.set(count.get() + 1); | 594 | 144k | Ok(()) | 595 | 144k | })?; |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Error, <regex_syntax::ast::Error as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Flags, <regex_syntax::ast::Flags as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 462 | recursive_count.with(|count| { | 590 | 462 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 462 | } | 593 | 462 | count.set(count.get() + 1); | 594 | 462 | Ok(()) | 595 | 462 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Group, <regex_syntax::ast::Group as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 475 | recursive_count.with(|count| { | 590 | 475 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 475 | } | 593 | 475 | count.set(count.get() + 1); | 594 | 475 | Ok(()) | 595 | 475 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Concat, <regex_syntax::ast::Concat as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 110 | recursive_count.with(|count| { | 590 | 110 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 110 | } | 593 | 110 | count.set(count.get() + 1); | 594 | 110 | Ok(()) | 595 | 110 | })?; |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Comment, <regex_syntax::ast::Comment as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Literal, <regex_syntax::ast::Literal as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 2.24k | recursive_count.with(|count| { | 590 | 2.24k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 2.24k | } | 593 | 2.24k | count.set(count.get() + 1); | 594 | 2.24k | Ok(()) | 595 | 2.24k | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSet, <regex_syntax::ast::ClassSet as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 125k | recursive_count.with(|count| { | 590 | 125k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 125k | } | 593 | 125k | count.set(count.get() + 1); | 594 | 125k | Ok(()) | 595 | 125k | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Position, <regex_syntax::ast::Position as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 304k | recursive_count.with(|count| { | 590 | 304k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 304k | } | 593 | 304k | count.set(count.get() + 1); | 594 | 304k | Ok(()) | 595 | 304k | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::SetFlags, <regex_syntax::ast::SetFlags as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 188 | recursive_count.with(|count| { | 590 | 188 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 188 | } | 593 | 188 | count.set(count.get() + 1); | 594 | 188 | Ok(()) | 595 | 188 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Assertion, <regex_syntax::ast::Assertion as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 478 | recursive_count.with(|count| { | 590 | 478 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 478 | } | 593 | 478 | count.set(count.get() + 1); | 594 | 478 | Ok(()) | 595 | 478 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassPerl, <regex_syntax::ast::ClassPerl as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 640 | recursive_count.with(|count| { | 590 | 640 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 640 | } | 593 | 640 | count.set(count.get() + 1); | 594 | 640 | Ok(()) | 595 | 640 | })?; |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ErrorKind, <regex_syntax::ast::ErrorKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItem, <regex_syntax::ast::FlagsItem as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 196 | recursive_count.with(|count| { | 590 | 196 | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 196 | } | 593 | 196 | count.set(count.get() + 1); | 594 | 196 | Ok(()) | 595 | 196 | })?; |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::GroupKind, <regex_syntax::ast::GroupKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#0}Line | Count | Source | 589 | 1.48k | recursive_count.with(|count| { | 590 | 1.48k | if count.get() > 0 { | 591 | 0 | return Err(Error::NotEnoughData); | 592 | 1.48k | } | 593 | 1.48k | count.set(count.get() + 1); | 594 | 1.48k | Ok(()) | 595 | 1.48k | })?; |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<_, _, _>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, fuzz_regex_lite_match::FuzzCase, <fuzz_regex_lite_match::FuzzCase as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_regex::FuzzData, <ast_fuzz_regex::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, fuzz_regex_match::FuzzCase, <fuzz_regex_match::FuzzCase as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_match_bytes::FuzzData, <ast_fuzz_match_bytes::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_match::FuzzData, <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#0} |
596 | 13.7M | } |
597 | | |
598 | 14.5M | let result = f(u); |
599 | | |
600 | 14.5M | if guard_against_recursion { |
601 | 725k | recursive_count.with(|count| { |
602 | 725k | count.set(count.get() - 1); |
603 | 725k | }); Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_roundtrip::FuzzData, <ast_roundtrip::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassAscii, <regex_syntax::ast::ClassAscii as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Repetition, <regex_syntax::ast::Repetition as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Alternation, <regex_syntax::ast::Alternation as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::LiteralKind, <regex_syntax::ast::LiteralKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetItem, <regex_syntax::ast::ClassSetItem as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassUnicode, <regex_syntax::ast::ClassUnicode as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionOp, <regex_syntax::ast::RepetitionOp as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::WithComments, <regex_syntax::ast::WithComments as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetRange, <regex_syntax::ast::ClassSetRange as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetUnion, <regex_syntax::ast::ClassSetUnion as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItemKind, <regex_syntax::ast::FlagsItemKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassBracketed, <regex_syntax::ast::ClassBracketed as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionKind, <regex_syntax::ast::RepetitionKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionRange, <regex_syntax::ast::RepetitionRange as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetBinaryOp, <regex_syntax::ast::ClassSetBinaryOp as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Ast, <regex_syntax::ast::Ast as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Span, <regex_syntax::ast::Span as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Error, <regex_syntax::ast::Error as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Flags, <regex_syntax::ast::Flags as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Group, <regex_syntax::ast::Group as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Concat, <regex_syntax::ast::Concat as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Comment, <regex_syntax::ast::Comment as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Literal, <regex_syntax::ast::Literal as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSet, <regex_syntax::ast::ClassSet as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Position, <regex_syntax::ast::Position as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::SetFlags, <regex_syntax::ast::SetFlags as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Assertion, <regex_syntax::ast::Assertion as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassPerl, <regex_syntax::ast::ClassPerl as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ErrorKind, <regex_syntax::ast::ErrorKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItem, <regex_syntax::ast::FlagsItem as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::GroupKind, <regex_syntax::ast::GroupKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassAscii, <regex_syntax::ast::ClassAscii as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 443 | recursive_count.with(|count| { | 602 | 443 | count.set(count.get() - 1); | 603 | 443 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Repetition, <regex_syntax::ast::Repetition as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 381 | recursive_count.with(|count| { | 602 | 381 | count.set(count.get() - 1); | 603 | 381 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Alternation, <regex_syntax::ast::Alternation as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 83 | recursive_count.with(|count| { | 602 | 83 | count.set(count.get() - 1); | 603 | 83 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::LiteralKind, <regex_syntax::ast::LiteralKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 6.02k | recursive_count.with(|count| { | 602 | 6.02k | count.set(count.get() - 1); | 603 | 6.02k | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetItem, <regex_syntax::ast::ClassSetItem as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 125k | recursive_count.with(|count| { | 602 | 125k | count.set(count.get() - 1); | 603 | 125k | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassUnicode, <regex_syntax::ast::ClassUnicode as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 323 | recursive_count.with(|count| { | 602 | 323 | count.set(count.get() - 1); | 603 | 323 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionOp, <regex_syntax::ast::RepetitionOp as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 1.40k | recursive_count.with(|count| { | 602 | 1.40k | count.set(count.get() - 1); | 603 | 1.40k | }); |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::WithComments, <regex_syntax::ast::WithComments as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetRange, <regex_syntax::ast::ClassSetRange as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 104 | recursive_count.with(|count| { | 602 | 104 | count.set(count.get() - 1); | 603 | 104 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetUnion, <regex_syntax::ast::ClassSetUnion as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 70 | recursive_count.with(|count| { | 602 | 70 | count.set(count.get() - 1); | 603 | 70 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItemKind, <regex_syntax::ast::FlagsItemKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 714 | recursive_count.with(|count| { | 602 | 714 | count.set(count.get() - 1); | 603 | 714 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassBracketed, <regex_syntax::ast::ClassBracketed as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 516 | recursive_count.with(|count| { | 602 | 516 | count.set(count.get() - 1); | 603 | 516 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionKind, <regex_syntax::ast::RepetitionKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 1.69k | recursive_count.with(|count| { | 602 | 1.69k | count.set(count.get() - 1); | 603 | 1.69k | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionRange, <regex_syntax::ast::RepetitionRange as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 19 | recursive_count.with(|count| { | 602 | 19 | count.set(count.get() - 1); | 603 | 19 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetBinaryOp, <regex_syntax::ast::ClassSetBinaryOp as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 790 | recursive_count.with(|count| { | 602 | 790 | count.set(count.get() - 1); | 603 | 790 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Ast, <regex_syntax::ast::Ast as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 6.56k | recursive_count.with(|count| { | 602 | 6.56k | count.set(count.get() - 1); | 603 | 6.56k | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Span, <regex_syntax::ast::Span as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 144k | recursive_count.with(|count| { | 602 | 144k | count.set(count.get() - 1); | 603 | 144k | }); |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Error, <regex_syntax::ast::Error as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Flags, <regex_syntax::ast::Flags as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 462 | recursive_count.with(|count| { | 602 | 462 | count.set(count.get() - 1); | 603 | 462 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Group, <regex_syntax::ast::Group as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 475 | recursive_count.with(|count| { | 602 | 475 | count.set(count.get() - 1); | 603 | 475 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Concat, <regex_syntax::ast::Concat as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 110 | recursive_count.with(|count| { | 602 | 110 | count.set(count.get() - 1); | 603 | 110 | }); |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Comment, <regex_syntax::ast::Comment as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Literal, <regex_syntax::ast::Literal as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 2.24k | recursive_count.with(|count| { | 602 | 2.24k | count.set(count.get() - 1); | 603 | 2.24k | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSet, <regex_syntax::ast::ClassSet as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 125k | recursive_count.with(|count| { | 602 | 125k | count.set(count.get() - 1); | 603 | 125k | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Position, <regex_syntax::ast::Position as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 304k | recursive_count.with(|count| { | 602 | 304k | count.set(count.get() - 1); | 603 | 304k | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::SetFlags, <regex_syntax::ast::SetFlags as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 188 | recursive_count.with(|count| { | 602 | 188 | count.set(count.get() - 1); | 603 | 188 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Assertion, <regex_syntax::ast::Assertion as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 478 | recursive_count.with(|count| { | 602 | 478 | count.set(count.get() - 1); | 603 | 478 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassPerl, <regex_syntax::ast::ClassPerl as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 640 | recursive_count.with(|count| { | 602 | 640 | count.set(count.get() - 1); | 603 | 640 | }); |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ErrorKind, <regex_syntax::ast::ErrorKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItem, <regex_syntax::ast::FlagsItem as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 196 | recursive_count.with(|count| { | 602 | 196 | count.set(count.get() - 1); | 603 | 196 | }); |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::GroupKind, <regex_syntax::ast::GroupKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>::{closure#1}Line | Count | Source | 601 | 1.48k | recursive_count.with(|count| { | 602 | 1.48k | count.set(count.get() - 1); | 603 | 1.48k | }); |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<_, _, _>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, fuzz_regex_lite_match::FuzzCase, <fuzz_regex_lite_match::FuzzCase as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_regex::FuzzData, <ast_fuzz_regex::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, fuzz_regex_match::FuzzCase, <fuzz_regex_match::FuzzCase as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_match_bytes::FuzzData, <ast_fuzz_match_bytes::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1}Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_match::FuzzData, <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>::{closure#1} |
604 | 13.7M | } |
605 | | |
606 | 14.5M | result |
607 | 14.5M | } arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_roundtrip::FuzzData, <ast_roundtrip::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Line | Count | Source | 582 | 9.39k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 9.39k | u: U, | 584 | 9.39k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 9.39k | f: impl FnOnce(U) -> Result<R>, | 586 | 9.39k | ) -> Result<R> { | 587 | 9.39k | let guard_against_recursion = u.is_empty(); | 588 | 9.39k | if guard_against_recursion { | 589 | 0 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 9.39k | } | 597 | | | 598 | 9.39k | let result = f(u); | 599 | | | 600 | 9.39k | if guard_against_recursion { | 601 | 0 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 9.39k | } | 605 | | | 606 | 9.39k | result | 607 | 9.39k | } |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassAscii, <regex_syntax::ast::ClassAscii as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Repetition, <regex_syntax::ast::Repetition as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Alternation, <regex_syntax::ast::Alternation as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::LiteralKind, <regex_syntax::ast::LiteralKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetItem, <regex_syntax::ast::ClassSetItem as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassUnicode, <regex_syntax::ast::ClassUnicode as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionOp, <regex_syntax::ast::RepetitionOp as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::WithComments, <regex_syntax::ast::WithComments as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetRange, <regex_syntax::ast::ClassSetRange as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetUnion, <regex_syntax::ast::ClassSetUnion as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItemKind, <regex_syntax::ast::FlagsItemKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassBracketed, <regex_syntax::ast::ClassBracketed as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionKind, <regex_syntax::ast::RepetitionKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionRange, <regex_syntax::ast::RepetitionRange as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetBinaryOp, <regex_syntax::ast::ClassSetBinaryOp as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Ast, <regex_syntax::ast::Ast as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Line | Count | Source | 582 | 24.8k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 24.8k | u: U, | 584 | 24.8k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 24.8k | f: impl FnOnce(U) -> Result<R>, | 586 | 24.8k | ) -> Result<R> { | 587 | 24.8k | let guard_against_recursion = u.is_empty(); | 588 | 24.8k | if guard_against_recursion { | 589 | 0 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 24.8k | } | 597 | | | 598 | 24.8k | let result = f(u); | 599 | | | 600 | 24.8k | if guard_against_recursion { | 601 | 0 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 24.8k | } | 605 | | | 606 | 24.8k | result | 607 | 24.8k | } |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Span, <regex_syntax::ast::Span as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Error, <regex_syntax::ast::Error as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Flags, <regex_syntax::ast::Flags as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Group, <regex_syntax::ast::Group as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Concat, <regex_syntax::ast::Concat as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Comment, <regex_syntax::ast::Comment as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Literal, <regex_syntax::ast::Literal as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSet, <regex_syntax::ast::ClassSet as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Position, <regex_syntax::ast::Position as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::SetFlags, <regex_syntax::ast::SetFlags as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::Assertion, <regex_syntax::ast::Assertion as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassPerl, <regex_syntax::ast::ClassPerl as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::ErrorKind, <regex_syntax::ast::ErrorKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItem, <regex_syntax::ast::FlagsItem as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Unexecuted instantiation: arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, regex_syntax::ast::GroupKind, <regex_syntax::ast::GroupKind as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassAscii, <regex_syntax::ast::ClassAscii as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 156k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 156k | u: U, | 584 | 156k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 156k | f: impl FnOnce(U) -> Result<R>, | 586 | 156k | ) -> Result<R> { | 587 | 156k | let guard_against_recursion = u.is_empty(); | 588 | 156k | if guard_against_recursion { | 589 | 443 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 155k | } | 597 | | | 598 | 156k | let result = f(u); | 599 | | | 600 | 156k | if guard_against_recursion { | 601 | 443 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 155k | } | 605 | | | 606 | 156k | result | 607 | 156k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Repetition, <regex_syntax::ast::Repetition as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 109k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 109k | u: U, | 584 | 109k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 109k | f: impl FnOnce(U) -> Result<R>, | 586 | 109k | ) -> Result<R> { | 587 | 109k | let guard_against_recursion = u.is_empty(); | 588 | 109k | if guard_against_recursion { | 589 | 381 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 108k | } | 597 | | | 598 | 109k | let result = f(u); | 599 | | | 600 | 109k | if guard_against_recursion { | 601 | 381 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 108k | } | 605 | | | 606 | 109k | result | 607 | 109k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Alternation, <regex_syntax::ast::Alternation as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 117k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 117k | u: U, | 584 | 117k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 117k | f: impl FnOnce(U) -> Result<R>, | 586 | 117k | ) -> Result<R> { | 587 | 117k | let guard_against_recursion = u.is_empty(); | 588 | 117k | if guard_against_recursion { | 589 | 83 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 117k | } | 597 | | | 598 | 117k | let result = f(u); | 599 | | | 600 | 117k | if guard_against_recursion { | 601 | 83 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 117k | } | 605 | | | 606 | 117k | result | 607 | 117k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::LiteralKind, <regex_syntax::ast::LiteralKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 307k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 307k | u: U, | 584 | 307k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 307k | f: impl FnOnce(U) -> Result<R>, | 586 | 307k | ) -> Result<R> { | 587 | 307k | let guard_against_recursion = u.is_empty(); | 588 | 307k | if guard_against_recursion { | 589 | 6.02k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 301k | } | 597 | | | 598 | 307k | let result = f(u); | 599 | | | 600 | 307k | if guard_against_recursion { | 601 | 6.02k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 301k | } | 605 | | | 606 | 307k | result | 607 | 307k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetItem, <regex_syntax::ast::ClassSetItem as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 865k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 865k | u: U, | 584 | 865k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 865k | f: impl FnOnce(U) -> Result<R>, | 586 | 865k | ) -> Result<R> { | 587 | 865k | let guard_against_recursion = u.is_empty(); | 588 | 865k | if guard_against_recursion { | 589 | 125k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 739k | } | 597 | | | 598 | 865k | let result = f(u); | 599 | | | 600 | 865k | if guard_against_recursion { | 601 | 125k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 739k | } | 605 | | | 606 | 865k | result | 607 | 865k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassUnicode, <regex_syntax::ast::ClassUnicode as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 371k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 371k | u: U, | 584 | 371k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 371k | f: impl FnOnce(U) -> Result<R>, | 586 | 371k | ) -> Result<R> { | 587 | 371k | let guard_against_recursion = u.is_empty(); | 588 | 371k | if guard_against_recursion { | 589 | 323 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 370k | } | 597 | | | 598 | 371k | let result = f(u); | 599 | | | 600 | 371k | if guard_against_recursion { | 601 | 323 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 370k | } | 605 | | | 606 | 371k | result | 607 | 371k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionOp, <regex_syntax::ast::RepetitionOp as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 109k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 109k | u: U, | 584 | 109k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 109k | f: impl FnOnce(U) -> Result<R>, | 586 | 109k | ) -> Result<R> { | 587 | 109k | let guard_against_recursion = u.is_empty(); | 588 | 109k | if guard_against_recursion { | 589 | 1.40k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 107k | } | 597 | | | 598 | 109k | let result = f(u); | 599 | | | 600 | 109k | if guard_against_recursion { | 601 | 1.40k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 107k | } | 605 | | | 606 | 109k | result | 607 | 109k | } |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::WithComments, <regex_syntax::ast::WithComments as arbitrary::Arbitrary>::arbitrary::{closure#0}>arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetRange, <regex_syntax::ast::ClassSetRange as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 18.3k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 18.3k | u: U, | 584 | 18.3k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 18.3k | f: impl FnOnce(U) -> Result<R>, | 586 | 18.3k | ) -> Result<R> { | 587 | 18.3k | let guard_against_recursion = u.is_empty(); | 588 | 18.3k | if guard_against_recursion { | 589 | 104 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 18.2k | } | 597 | | | 598 | 18.3k | let result = f(u); | 599 | | | 600 | 18.3k | if guard_against_recursion { | 601 | 104 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 18.2k | } | 605 | | | 606 | 18.3k | result | 607 | 18.3k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetUnion, <regex_syntax::ast::ClassSetUnion as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 105k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 105k | u: U, | 584 | 105k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 105k | f: impl FnOnce(U) -> Result<R>, | 586 | 105k | ) -> Result<R> { | 587 | 105k | let guard_against_recursion = u.is_empty(); | 588 | 105k | if guard_against_recursion { | 589 | 70 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 105k | } | 597 | | | 598 | 105k | let result = f(u); | 599 | | | 600 | 105k | if guard_against_recursion { | 601 | 70 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 105k | } | 605 | | | 606 | 105k | result | 607 | 105k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItemKind, <regex_syntax::ast::FlagsItemKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 97.1k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 97.1k | u: U, | 584 | 97.1k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 97.1k | f: impl FnOnce(U) -> Result<R>, | 586 | 97.1k | ) -> Result<R> { | 587 | 97.1k | let guard_against_recursion = u.is_empty(); | 588 | 97.1k | if guard_against_recursion { | 589 | 714 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 96.4k | } | 597 | | | 598 | 97.1k | let result = f(u); | 599 | | | 600 | 97.1k | if guard_against_recursion { | 601 | 714 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 96.4k | } | 605 | | | 606 | 97.1k | result | 607 | 97.1k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassBracketed, <regex_syntax::ast::ClassBracketed as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 168k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 168k | u: U, | 584 | 168k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 168k | f: impl FnOnce(U) -> Result<R>, | 586 | 168k | ) -> Result<R> { | 587 | 168k | let guard_against_recursion = u.is_empty(); | 588 | 168k | if guard_against_recursion { | 589 | 516 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 168k | } | 597 | | | 598 | 168k | let result = f(u); | 599 | | | 600 | 168k | if guard_against_recursion { | 601 | 516 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 168k | } | 605 | | | 606 | 168k | result | 607 | 168k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionKind, <regex_syntax::ast::RepetitionKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 109k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 109k | u: U, | 584 | 109k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 109k | f: impl FnOnce(U) -> Result<R>, | 586 | 109k | ) -> Result<R> { | 587 | 109k | let guard_against_recursion = u.is_empty(); | 588 | 109k | if guard_against_recursion { | 589 | 1.69k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 107k | } | 597 | | | 598 | 109k | let result = f(u); | 599 | | | 600 | 109k | if guard_against_recursion { | 601 | 1.69k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 107k | } | 605 | | | 606 | 109k | result | 607 | 109k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::RepetitionRange, <regex_syntax::ast::RepetitionRange as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 38.0k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 38.0k | u: U, | 584 | 38.0k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 38.0k | f: impl FnOnce(U) -> Result<R>, | 586 | 38.0k | ) -> Result<R> { | 587 | 38.0k | let guard_against_recursion = u.is_empty(); | 588 | 38.0k | if guard_against_recursion { | 589 | 19 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 38.0k | } | 597 | | | 598 | 38.0k | let result = f(u); | 599 | | | 600 | 38.0k | if guard_against_recursion { | 601 | 19 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 38.0k | } | 605 | | | 606 | 38.0k | result | 607 | 38.0k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSetBinaryOp, <regex_syntax::ast::ClassSetBinaryOp as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 238k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 238k | u: U, | 584 | 238k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 238k | f: impl FnOnce(U) -> Result<R>, | 586 | 238k | ) -> Result<R> { | 587 | 238k | let guard_against_recursion = u.is_empty(); | 588 | 238k | if guard_against_recursion { | 589 | 790 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 238k | } | 597 | | | 598 | 238k | let result = f(u); | 599 | | | 600 | 238k | if guard_against_recursion { | 601 | 790 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 238k | } | 605 | | | 606 | 238k | result | 607 | 238k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Ast, <regex_syntax::ast::Ast as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 1.36M | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 1.36M | u: U, | 584 | 1.36M | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 1.36M | f: impl FnOnce(U) -> Result<R>, | 586 | 1.36M | ) -> Result<R> { | 587 | 1.36M | let guard_against_recursion = u.is_empty(); | 588 | 1.36M | if guard_against_recursion { | 589 | 6.56k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 1.35M | } | 597 | | | 598 | 1.36M | let result = f(u); | 599 | | | 600 | 1.36M | if guard_against_recursion { | 601 | 6.56k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 1.35M | } | 605 | | | 606 | 1.36M | result | 607 | 1.36M | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Span, <regex_syntax::ast::Span as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 2.78M | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 2.78M | u: U, | 584 | 2.78M | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 2.78M | f: impl FnOnce(U) -> Result<R>, | 586 | 2.78M | ) -> Result<R> { | 587 | 2.78M | let guard_against_recursion = u.is_empty(); | 588 | 2.78M | if guard_against_recursion { | 589 | 144k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 2.64M | } | 597 | | | 598 | 2.78M | let result = f(u); | 599 | | | 600 | 2.78M | if guard_against_recursion { | 601 | 144k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 2.64M | } | 605 | | | 606 | 2.78M | result | 607 | 2.78M | } |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Error, <regex_syntax::ast::Error as arbitrary::Arbitrary>::arbitrary::{closure#0}>arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Flags, <regex_syntax::ast::Flags as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 45.5k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 45.5k | u: U, | 584 | 45.5k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 45.5k | f: impl FnOnce(U) -> Result<R>, | 586 | 45.5k | ) -> Result<R> { | 587 | 45.5k | let guard_against_recursion = u.is_empty(); | 588 | 45.5k | if guard_against_recursion { | 589 | 462 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 45.0k | } | 597 | | | 598 | 45.5k | let result = f(u); | 599 | | | 600 | 45.5k | if guard_against_recursion { | 601 | 462 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 45.0k | } | 605 | | | 606 | 45.5k | result | 607 | 45.5k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Group, <regex_syntax::ast::Group as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 121k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 121k | u: U, | 584 | 121k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 121k | f: impl FnOnce(U) -> Result<R>, | 586 | 121k | ) -> Result<R> { | 587 | 121k | let guard_against_recursion = u.is_empty(); | 588 | 121k | if guard_against_recursion { | 589 | 475 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 121k | } | 597 | | | 598 | 121k | let result = f(u); | 599 | | | 600 | 121k | if guard_against_recursion { | 601 | 475 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 121k | } | 605 | | | 606 | 121k | result | 607 | 121k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Concat, <regex_syntax::ast::Concat as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 272k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 272k | u: U, | 584 | 272k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 272k | f: impl FnOnce(U) -> Result<R>, | 586 | 272k | ) -> Result<R> { | 587 | 272k | let guard_against_recursion = u.is_empty(); | 588 | 272k | if guard_against_recursion { | 589 | 110 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 272k | } | 597 | | | 598 | 272k | let result = f(u); | 599 | | | 600 | 272k | if guard_against_recursion { | 601 | 110 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 272k | } | 605 | | | 606 | 272k | result | 607 | 272k | } |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Comment, <regex_syntax::ast::Comment as arbitrary::Arbitrary>::arbitrary::{closure#0}>arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Literal, <regex_syntax::ast::Literal as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 307k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 307k | u: U, | 584 | 307k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 307k | f: impl FnOnce(U) -> Result<R>, | 586 | 307k | ) -> Result<R> { | 587 | 307k | let guard_against_recursion = u.is_empty(); | 588 | 307k | if guard_against_recursion { | 589 | 2.24k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 304k | } | 597 | | | 598 | 307k | let result = f(u); | 599 | | | 600 | 307k | if guard_against_recursion { | 601 | 2.24k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 304k | } | 605 | | | 606 | 307k | result | 607 | 307k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassSet, <regex_syntax::ast::ClassSet as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 646k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 646k | u: U, | 584 | 646k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 646k | f: impl FnOnce(U) -> Result<R>, | 586 | 646k | ) -> Result<R> { | 587 | 646k | let guard_against_recursion = u.is_empty(); | 588 | 646k | if guard_against_recursion { | 589 | 125k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 521k | } | 597 | | | 598 | 646k | let result = f(u); | 599 | | | 600 | 646k | if guard_against_recursion { | 601 | 125k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 521k | } | 605 | | | 606 | 646k | result | 607 | 646k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Position, <regex_syntax::ast::Position as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 5.57M | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 5.57M | u: U, | 584 | 5.57M | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 5.57M | f: impl FnOnce(U) -> Result<R>, | 586 | 5.57M | ) -> Result<R> { | 587 | 5.57M | let guard_against_recursion = u.is_empty(); | 588 | 5.57M | if guard_against_recursion { | 589 | 304k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 5.26M | } | 597 | | | 598 | 5.57M | let result = f(u); | 599 | | | 600 | 5.57M | if guard_against_recursion { | 601 | 304k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 5.26M | } | 605 | | | 606 | 5.57M | result | 607 | 5.57M | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::SetFlags, <regex_syntax::ast::SetFlags as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 12.0k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 12.0k | u: U, | 584 | 12.0k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 12.0k | f: impl FnOnce(U) -> Result<R>, | 586 | 12.0k | ) -> Result<R> { | 587 | 12.0k | let guard_against_recursion = u.is_empty(); | 588 | 12.0k | if guard_against_recursion { | 589 | 188 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 11.8k | } | 597 | | | 598 | 12.0k | let result = f(u); | 599 | | | 600 | 12.0k | if guard_against_recursion { | 601 | 188 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 11.8k | } | 605 | | | 606 | 12.0k | result | 607 | 12.0k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::Assertion, <regex_syntax::ast::Assertion as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 145k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 145k | u: U, | 584 | 145k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 145k | f: impl FnOnce(U) -> Result<R>, | 586 | 145k | ) -> Result<R> { | 587 | 145k | let guard_against_recursion = u.is_empty(); | 588 | 145k | if guard_against_recursion { | 589 | 478 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 145k | } | 597 | | | 598 | 145k | let result = f(u); | 599 | | | 600 | 145k | if guard_against_recursion { | 601 | 478 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 145k | } | 605 | | | 606 | 145k | result | 607 | 145k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ClassPerl, <regex_syntax::ast::ClassPerl as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 74.0k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 74.0k | u: U, | 584 | 74.0k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 74.0k | f: impl FnOnce(U) -> Result<R>, | 586 | 74.0k | ) -> Result<R> { | 587 | 74.0k | let guard_against_recursion = u.is_empty(); | 588 | 74.0k | if guard_against_recursion { | 589 | 640 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 73.4k | } | 597 | | | 598 | 74.0k | let result = f(u); | 599 | | | 600 | 74.0k | if guard_against_recursion { | 601 | 640 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 73.4k | } | 605 | | | 606 | 74.0k | result | 607 | 74.0k | } |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::ErrorKind, <regex_syntax::ast::ErrorKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::FlagsItem, <regex_syntax::ast::FlagsItem as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 97.1k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 97.1k | u: U, | 584 | 97.1k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 97.1k | f: impl FnOnce(U) -> Result<R>, | 586 | 97.1k | ) -> Result<R> { | 587 | 97.1k | let guard_against_recursion = u.is_empty(); | 588 | 97.1k | if guard_against_recursion { | 589 | 196 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 96.9k | } | 597 | | | 598 | 97.1k | let result = f(u); | 599 | | | 600 | 97.1k | if guard_against_recursion { | 601 | 196 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 96.9k | } | 605 | | | 606 | 97.1k | result | 607 | 97.1k | } |
arbitrary::details::with_recursive_count::<&mut arbitrary::unstructured::Unstructured, regex_syntax::ast::GroupKind, <regex_syntax::ast::GroupKind as arbitrary::Arbitrary>::arbitrary::{closure#0}>Line | Count | Source | 582 | 121k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 121k | u: U, | 584 | 121k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 121k | f: impl FnOnce(U) -> Result<R>, | 586 | 121k | ) -> Result<R> { | 587 | 121k | let guard_against_recursion = u.is_empty(); | 588 | 121k | if guard_against_recursion { | 589 | 1.48k | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 120k | } | 597 | | | 598 | 121k | let result = f(u); | 599 | | | 600 | 121k | if guard_against_recursion { | 601 | 1.48k | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 120k | } | 605 | | | 606 | 121k | result | 607 | 121k | } |
Unexecuted instantiation: arbitrary::details::with_recursive_count::<_, _, _> arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, fuzz_regex_lite_match::FuzzCase, <fuzz_regex_lite_match::FuzzCase as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Line | Count | Source | 582 | 8.11k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 8.11k | u: U, | 584 | 8.11k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 8.11k | f: impl FnOnce(U) -> Result<R>, | 586 | 8.11k | ) -> Result<R> { | 587 | 8.11k | let guard_against_recursion = u.is_empty(); | 588 | 8.11k | if guard_against_recursion { | 589 | 0 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 8.11k | } | 597 | | | 598 | 8.11k | let result = f(u); | 599 | | | 600 | 8.11k | if guard_against_recursion { | 601 | 0 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 8.11k | } | 605 | | | 606 | 8.11k | result | 607 | 8.11k | } |
arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_regex::FuzzData, <ast_fuzz_regex::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Line | Count | Source | 582 | 15.4k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 15.4k | u: U, | 584 | 15.4k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 15.4k | f: impl FnOnce(U) -> Result<R>, | 586 | 15.4k | ) -> Result<R> { | 587 | 15.4k | let guard_against_recursion = u.is_empty(); | 588 | 15.4k | if guard_against_recursion { | 589 | 0 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 15.4k | } | 597 | | | 598 | 15.4k | let result = f(u); | 599 | | | 600 | 15.4k | if guard_against_recursion { | 601 | 0 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 15.4k | } | 605 | | | 606 | 15.4k | result | 607 | 15.4k | } |
arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, fuzz_regex_match::FuzzCase, <fuzz_regex_match::FuzzCase as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Line | Count | Source | 582 | 19.7k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 19.7k | u: U, | 584 | 19.7k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 19.7k | f: impl FnOnce(U) -> Result<R>, | 586 | 19.7k | ) -> Result<R> { | 587 | 19.7k | let guard_against_recursion = u.is_empty(); | 588 | 19.7k | if guard_against_recursion { | 589 | 0 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 19.7k | } | 597 | | | 598 | 19.7k | let result = f(u); | 599 | | | 600 | 19.7k | if guard_against_recursion { | 601 | 0 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 19.7k | } | 605 | | | 606 | 19.7k | result | 607 | 19.7k | } |
arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_match_bytes::FuzzData, <ast_fuzz_match_bytes::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Line | Count | Source | 582 | 26.0k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 26.0k | u: U, | 584 | 26.0k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 26.0k | f: impl FnOnce(U) -> Result<R>, | 586 | 26.0k | ) -> Result<R> { | 587 | 26.0k | let guard_against_recursion = u.is_empty(); | 588 | 26.0k | if guard_against_recursion { | 589 | 0 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 26.0k | } | 597 | | | 598 | 26.0k | let result = f(u); | 599 | | | 600 | 26.0k | if guard_against_recursion { | 601 | 0 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 26.0k | } | 605 | | | 606 | 26.0k | result | 607 | 26.0k | } |
arbitrary::details::with_recursive_count::<arbitrary::unstructured::Unstructured, ast_fuzz_match::FuzzData, <ast_fuzz_match::FuzzData as arbitrary::Arbitrary>::arbitrary_take_rest::{closure#0}>Line | Count | Source | 582 | 28.1k | pub fn with_recursive_count<U: IsEmpty, R>( | 583 | 28.1k | u: U, | 584 | 28.1k | recursive_count: &'static std::thread::LocalKey<std::cell::Cell<u32>>, | 585 | 28.1k | f: impl FnOnce(U) -> Result<R>, | 586 | 28.1k | ) -> Result<R> { | 587 | 28.1k | let guard_against_recursion = u.is_empty(); | 588 | 28.1k | if guard_against_recursion { | 589 | 0 | recursive_count.with(|count| { | 590 | | if count.get() > 0 { | 591 | | return Err(Error::NotEnoughData); | 592 | | } | 593 | | count.set(count.get() + 1); | 594 | | Ok(()) | 595 | 0 | })?; | 596 | 28.1k | } | 597 | | | 598 | 28.1k | let result = f(u); | 599 | | | 600 | 28.1k | if guard_against_recursion { | 601 | 0 | recursive_count.with(|count| { | 602 | | count.set(count.get() - 1); | 603 | | }); | 604 | 28.1k | } | 605 | | | 606 | 28.1k | result | 607 | 28.1k | } |
|
608 | | } |