Is it possible for a proc macro to read the
cfg flags that are set while the macro is being executed?
#[cfg(...)] and friends will work on the ones defined when the proc macro crate itself is being compiled, which aren’t necessarily the same, and it would be a nice way to let different crates in the same project control the macro’s behavior indepently.
In particular, I want it to expand slightly differently when used inside its partner ordinary crate instead of a downstream user of the pair— The most promising avenue I see right now is compiling my crate with a
cfg flag that won’t be in general use.
Please note that this is a pedagogical exercise to poke at the limits of what proc macros can and can’t do; I’m not interested in any solution that involves altering the callsite itself by, for example, adding another argument.