In pest we’re considering ways to potentially get debug compile times lower. After parsing, we do some optimization work to emit good parsing code, which could be skipped in debug mode. Alternatively, we could validate the grammar file and then hook up the interpreter when compiling with
Is there any way for buildscripts/proc macros/etc called by the compiler to generate code to know what optimization level to emit code for? If not, where’s the most recent discussion around adding a way to know this? (I know I’ve seen it at least once.)
I know about (ab)using
#[cfg(debug_assertions)] for this, but it’s an unfortunate hack, as debug assertions are a separate axis from optimization. And since this is about doing more/less work in the proc macro, moreso than the generated code, this is reliant on the current limitation of the compiler/cargo that (compile time) dependencies must be used at the same optimization level as the target crate.