Skip to content

Set environment variable for doctests #9886

Closed
@CobaltCause

Description

@CobaltCause

Describe the problem you are trying to solve

Currently, it's possible to detect whether a procedural macro is being used in a normal context (i.e. library or binary crate) or integration test depending on whether the CARGO_TARGET_TMPDIR environment variable is set. This is very useful for proc-macro-crate, which allows usage of a proc macro using types from a crate in the crate defining those types. However, there appears to be no way to distinguish between being used in a "normal context" and being used in doctests.

Describe the solution you'd like

In order to allow this, I think either CARGO_TARGET_TMPDIR should be set for doctests if that makes any sense, or a new environment variable should be introduced that indicates that the current build is for a doctest.

Notes

See also this issue: bkchr/proc-macro-crate#10

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions