Description
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