Skip to content

There are no documentation that cargo currently does not tell build script if cfg!(test) or not #13294

Closed
@anatawa12

Description

@anatawa12

In #4789, an member of the repository says "This is currently intentional behavior because build scripts don't have a "I'm running tests" mode." but it looks there are no documentation about that in cargo book.

https://github.com/rust-lang/cargo/blob/92395d90106b3b61bcb68bcf2069052c93771764/src/doc/src/reference/environment-variables.md#environment-variables-cargo-sets-for-build-scripts
https://github.com/rust-lang/cargo/blob/92395d90106b3b61bcb68bcf2069052c93771764/src/doc/src/reference/build-scripts.md

I think it's good to mention that in the cargo book.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-scriptsArea: build.rs scriptsA-documenting-cargo-itselfArea: Cargo's documentationA-environment-variablesArea: environment variablesS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions