cargo-fuzz
cargo-fuzz copied to clipboard
Could not compile: Can't find crate rust
I've used libfuzzer a lot in C++, and decided to try it in Rust as my first project.
This is probably a beginner issue, but I managed to switch to nightly, call cargo init fuzz, and when running the default fuzz_target_1 I get this:
--> fuzz_targets/fuzz_target_1.rs:3:1
|
3 | extern crate rust;
| ^^^^^^^^^^^^^^^^^^ can't find crate
Clearly, some crate is missing, but why? And cargo install rust had no effect.
Is your crate named rust? Usually the crate there is the crate you're running cargo-fuzz within
My crate? I didn't consider that, and yes you are completely right. My project is in a folder called rust. I guess that makes it a crate in the world of Rust. What exactly is the error about?
You have to run cargo fuzz init in the top-level directory of a rust crate
Yes, I have done that, and it does show the targets when listed:
$ cargo fuzz list
fuzz_target_1
I ran into the same issue. In my case the problem was that the parent project was a binary. It needs to be a library instead.