Pass command line flags to compiler plugin?


#1

Is there any way for a compiler plugin to access flags passed to rustc? Better yet, is there a way for it to define its own flags that won’t cause rustc to error out on an unrecognized flag?


#2

Beyond feature flags, I think your next best bet is the environment, either with env!("name") or std::env::var("name") depending on when you need to read it. (I’m not sure for a plugin…)


#3

Oh that’s not a bad idea! Thanks!