What is proc_macro::quote and what's wrong with quote::quote?

I've noticed the quote macro in proc_macro crate, essentially in std. From the first look it looks pretty much the same as the external crate quote that we all admire and respect. So what's point in bringing a copy of a famous tool in the std itself (apart from Not Invented Here syndrome)?

NB: I swear it's not trolling, I'm really curious and would love to figure this out

The quote from std came first, the quote crate was a reimplementation on stable, and is even more powerful (std quote doesn't do repetition iirc). In fact, there's a third quote!: proc-quote.

opting to proc_quote has the advantage of lifting some of the limitations of the original quasi-quoting crate:

  • Interpolate a ToTokens variable inside of a repeating block
  • Interpolate the same Iterator more than once inside of the same repeating block
  • Use Vec , arrays and slices in a repeating block without consuming the variable
3 Likes