Skip to content

Handle Groups with Delimiter::None #50

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

Merged
merged 1 commit into from
Jun 1, 2020

Conversation

Aaron1011
Copy link
Contributor

Currently, rustc does not pass the exact original TokenStream to
proc-macros in several cases. This has many undesirable effects, such as
losing correct location information in error message.
See rust-lang/rust#43081 for more details

In the future, rustc will begin passing the correct TokenStream to
proc-macros. As a result, some tokens may be wrapped in a
TokenTree::Group with Delimiter::None (when the tokens originally
came from a macro_rules!) macro expansion.

I've determined that this change will cause your crate to stop working
on some inputs. This PR updates hex-literal-impl to be compatible with both the
old and new TokenStream contents.

If you have any questions, feel free to ask me. See rust-lang/rust#72622 for more details

Currently, rustc does not pass the exact original `TokenStream` to
proc-macros in several cases. This has many undesirable effects, such as
losing correct location information in error message.
See rust-lang/rust#43081 for more details

In the future, rustc will begin passing the correct `TokenStream` to
proc-macros. As a result, some tokens may be wrapped in a
`TokenTree::Group` with `Delimiter::None` (when the tokens originally
came from a `macro_rules!`) macro expansion.

I've determined that this change will cause your crate to stop working
on some inputs. This PR updates `hex-literal-impl` to be compatible with both the
old and new `TokenStream` contents.

If you have any questions, feel free to ask me. See rust-lang/rust#72622 for more details
@tarcieri tarcieri requested a review from newpavlov May 31, 2020 15:57
@newpavlov newpavlov merged commit bd10ffa into RustCrypto:master Jun 1, 2020
@newpavlov
Copy link
Member

@Aaron1011
Am I correct that the workaround is not needed in Rust 1.56 and later?

@Aaron1011
Copy link
Contributor Author

@newpavlov Newer versions of rust have stopped wrapping :ident tokens in None-delimited groups. However, they're still used for other matches, so proc-macros still need to handle None-delimited groups in general.

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.

3 participants