Skip to content

make code compiled with cfg(test) visible across crates #8379

@toxeus

Description

@toxeus

I find myself creating test helpers/mocks in my test modules that are marked with #[cfg(test)]. They are exported as pub and can conveniently be used throughout the crate.
These helpers are not visible from other crates nor from integration tests in particular.

Making code compiled with cfg(test) be visible outside of the scope of a crate would allow for better code reuse. Please consider adapting that behavior.

Related: rust-lang/rust#45599

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-testS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions