Conversation
This adds a "std" feature that enables support for compilation with std. By default, the library compiles with support for std types, but this can be disabled with --no-default-features.
|
Note that this should address issue #38 as well. |
|
See #62 (comment). What are you using Would like to hear more about whether your use case actually requires arbitrary itself to be no-std. |
I started out that way in my use case. The case is a large no_std crate where I want to derive Arbitrary on structs that are defined in that crate. Without no_std support, adding #[derive(Arbitrary, Debug)]
enum Methods {
FirstMethod {
param1: usize,
param2: MyStruct,
},
// ... other methods
}where I realize that there's a workaround: use conditional compilation to turn on std in the crate when fuzzing, and only derive Arbitrary in that context. The value I see in this change is simplifying the task of adding fuzzing to these kinds of crates at the cost of some increased complexity in the |
Yes, this is what I was about to suggest, and I do see the value in not requiring users to add a conditional However, the benefit of this approach, over making |
|
I want to fuzz an embedded target, where no_std support comes in handy... ;) |
This isn't as much a workaround as it is the recommended way to do things, IMO. Arbitrary may need to use std types in its implementation so it's tricky to constrain ourselves to no_std. However, libFuzzer fuzzing always occurs in a std context, so you can use We could potentially still have a std feature (on by default) which when disabled may affect the existence of Arbitrary impls for some no_std types. But I'm not sure if this is worth it. |
|
Yep, you can use Re-upping my earlier comment from that other thread once again:
Before we close this issue, I think we should at least have some docs/examples of how to implement |
|
I updated the PR in my fork, to address the merging conflicts: https://github.com/bitwave/arbitrary/tree/no_std |
|
Any updates? |
Not if the fuzz target is a custom operating system & I have to use no_std and write mem alloc myself... |
|
To add as a use case: It would be easier for a library if we did not need to care, and could specify And a second use case: |
This adds a "std" feature that enables support for compilation with std. Without this feature, the library becomes compatible with #![no_std] crates.
By default, the library compiles with support for std types, but this can be disabled with --no-default-features.