crate-level inner attribute macros are still unsupported [0], so if you want those, you'll need to do the codegen before the compiler takes a pass or from within the compiler itself (using, say an after_parsing [1] hook). They're really helpful for making a deeply embedded DSL.
[0] https://github.com/rust-lang/rust/issues/54726
[1] https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver...