I'm wondering if anyone has a good solution for the fact that proc macros evaluate before const expressions get their value? Basically, I just want to do something like this:
use seq_macro::seq;
const COUNT: usize = 2;
seq!(N in 0..COUNT {
#(
type T~N;
)*
});
const evaluation always happens after macro expansion, so I don't think this is possible. But since you are asking for a #define, I don't think you actually need a const.
If the reason you want the macro to operate over the value of the const is that you want to keep the macro output consistent with the const value, then I suggest you go the other way around: let the macro expand to the definition of the const:
It doesn't solve my particular issue as I'm trying to make sure multiple invocations of the macro (across multiple modules) have the same constant. But it's still an excellent idea.