Inter-edition usage of macros


#1

When we say “the Rust compiler can link crates of any editions together”, I pretty much believe it merely means it can “link” crates of any editions together, but that doesn’t cover all the case editions can be mixed.

Specifically what should happen when a crate calls a macro from another crate which is using a different edition? Should the code expanded / generated use the edition of the caller or callee?

It seems the most obvious solution would be, to compile code from macro with the edition of the macro provider. But macro can accept arbitrary code piece, so the boundary of different editions may become a problem. It’s not clear to me how feasible this solution is from the compiler’s point of view.

I may be missing something, but I don’t think I saw any discussion related to this before, and I believe this is something we should consider for the edition release.

If there has been discussion and there have been some conclusions, it’s probably worth being put into documents like the edition guide.


#2

(Drive-by link-only comment with greetings from RustFest!)