How to import from /crates/x/tests into /fuzz?

Say for example I have a struct Normalizer here ruff/crates/ruff_python_formatter/tests/ at main · astral-sh/ruff · GitHub and i would like to import that in fuzz target ruff_parse_simple in ruff/fuzz/fuzz_targets/ at main · astral-sh/ruff · GitHub
How can i do that ?

There's no way to import private items like your Normalizer, which is pub(crate). There's also no way to import things from integration tests. You can either refactor it into its own crate, or copy the code.


You can make the Normalizer public but hidden:

pub struct Normalizer;

This makes it accessible to dependents, but it's generally accepted that hiding it from documentation means “this is an implementation detail and I don't promise it is reasonable to use or semver-stable”. IDE tools like rust-analyzer will also hide it from suggestions.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.