Set environment variable for doctests #9886
Labels
A-doctests
Area: rustdoc --test
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
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 forproc-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
The text was updated successfully, but these errors were encountered: