Macro hygiene only for expressions/variables but not for types?

This came up recently here as well

Here's an excerpt from The Little Book of Rust Macros linked in that thread

macro_rules! macros in Rust are partially hygienic, also called mixed hygiene. Specifically, they are hygienic when it comes to local variables, labels and $crate, but nothing else.

My understanding is that it is intentional, but that it isn't necessarily going to be how macros work in declarative macros 2.0 (aka macro aka decl_macro aka macros-by-example). But also a lot of things are still up in the air on that feature so take that with a grain of salt.

2 Likes