Macro aficionados, forgather!

Because I need some help on this one.

If you dont want to open link, please, you may just answer these questions:

  1. Why unicode characters are not allowed in macro rules?
  2. Why pat fragment followed by <- is considered ill formed?
  3. What is the strategy for matching macro rules?

Thank you for your attention. :slightly_smiling_face:

Only valid tokens are allowed inside macro rules. is not a valid token.

There are several restrictions around what tokens a fragments can be followed by to ensure that introducing new syntax is not a breaking change. <- happens to not be in the whitelist for pattern fragments.

Roughly it will try to match the first option and if that doesn't work, the second and so on.

Unrelated to your specific questions, but you can find a lot of useful information in the little book of rust macros.


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.