Skip to content
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

Add example to Token! documentation #1510

Merged
merged 1 commit into from
Sep 15, 2023
Merged

Conversation

ModProg
Copy link
Contributor

@ModProg ModProg commented Sep 14, 2023

This allows rust-analyzer to correctly complete the preferred brackets, instead of parenthesis.

rust-lang/rust-analyzer#15608 (comment)

I wasn't sure what to put in there as the extensive documentation is at the module doc

This allows rust-analyzer to correctly complete the preferred brackets, instead of parenthesis.
src/token.rs Show resolved Hide resolved
src/token.rs Outdated Show resolved Hide resolved
src/token.rs Outdated Show resolved Hide resolved
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

The example you wrote would get shown to the reader like this:

which is pretty misleading as to how this macro is supposed to be used.

error: macro expansion ends with an incomplete expression: expected one of `!` or `::`
   --> syn-2.0.31/src/token.rs:866:41
    |
866 |     [fn]          => { $crate::token::Fn };
    |                                         ^ expected one of `!` or `::`
    |
   ::: src/lib.rs:1:1
    |
1   | Token![fn]; // syn::token::Fn
    | ---------- in this macro invocation

Could you come up with a more meaningful usage to show in the example?

@dtolnay dtolnay merged commit 319433e into dtolnay:master Sep 15, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants