#Detect if we are running inside a proc macro?

9 messages · Page 1 of 1 (latest)

frigid vortex
#

I have a pub function export which, for a long list of reasons, I would like users of my library to only use inside of proc macros. Is there a way I can detect that we are currently running within a proc macro, and panic if we are not?

tribal mirage
frigid vortex
#

thanks, that was what I had in mind actually!

#

anyone have any idea which env var to look for?

tribal mirage
#

Probably any combination of TARGET, NUM_JOBS, OPT_LEVEL, PROFILE

floral bluff
#

that's not exactly useful

tribal mirage
#

those are the ones that aren't included in the normal files, and are not likely to be on the system

floral bluff
#

I'm mistaken