Where to learn the precise kind of hygiene that Rust macros provide

I'm trying to understand precisely what sort of hygienic macros are provided by Rust. The reason I'm asking this question is that a search thru the literature, e.g. Clinge&Wand ( https://dl.acm.org/doi/10.1145/3386330 ) would indicate that there's been a TON of work in this area over the decades, and so, well, if one is to have a good idea of what Rust does, it had better be precise. I know I can RTSC, and I intend to do that if nothing else works, but I figured I'd ask if there's some precise reference, before executing that swan dive.

I don't know if there's an official reference for the precise hygiene rules of macros, which seems wrong?

The closest I've seen is actually the documentation for Ident in proc_macro - Rust and Span in proc_macro - Rust

There's also the non-official, but cited by the official Rust Book, "Little Book of Rust Macros", which has a lot more detail, especially on macro_rules! macros: Hygiene - The Little Book of Rust Macros

Ahh, thank you! Now I remember I read that, but it just didn't .... stick with me. This time it will. You hit it in one!

You might see macro_rules macros be described as Macros By Example - The Rust Reference in places, which I think is a reference to https://dl.acm.org/doi/abs/10.1145/41625.41632

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.