-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update macros-by-example.md #1480
Conversation
correct syntax '_MacroRulesDef_' NOTE: I tried to use round and square brackets. It seems that only curly brackets are allowed.
Also NOTE: Later on, the MacroMatcher, can have round, square and curly brackets. |
% rustc --version |
Thanks for the PR! However, I don't quite understand the change. Parentheses and square brackets are valid: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4cb725835420bff6d2cd198e8c847581 Perhaps you are missing the semicolon? |
Thank your for clarifying. Yes, inside you can use all three, but directly after the IDENTFIER the marco rules (symbol "MacroRules") can not be put into square brackets or round brackets. The marco rules can only be put into curly braces. Look at the compiler error and it's suggestion:
|
In the given play link, it uses square or round brackets directly after the IDENTIFIER. The given error message explains the options:
It looks like from your error message, it is missing a semicolon. |
OK, you are right. According to the syntax it has to end with semicolon when round or square brackets are used. When you use curly brackets then it must NOT use a semicolon at the end. ...% cargo run I overlooked that. May be because such syntax looks wierd to me. In particular, why the exception for round or square brackets? May be there is a reason that I just don't understand. However, the syntax is documented correctly. I withdraw my PR. Sorry, for the inconvinence. Best regards Jörg |
I hope it was the right action, to close the PR, was it? I am not used to GitHub PRs, so far. |
correct syntax 'MacroRulesDef'
NOTE: I tried to use round and square brackets. It seems that only curly brackets are allowed.