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

Handle nested syn::Type:::Group #3

Merged
merged 1 commit into from
Jun 6, 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, syn may wrap a type in one or more
syn::Type::Groups (if the proc-macro input came from a macro_rules! expansion).

I've determined that this can cause oauth1-request-derive to fail to match
a Type::Path. This PR should properly handle nested groups, allowing
your crate to work with both old and new input.

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, `syn` may wrap a type in one or more
`syn::Type::Group`s (if the proc-macro input came from a `macro_rules!` expansion).

I've determined that this can cause `oauth1-request-derive` to fail to match
a `Type::Path`. This PR should properly handle nested groups, allowing
your crate to work with both old and new input.

If you have any questions, feel free to ask me. See rust-lang/rust#72622
for more details.
@Aaron1011
Copy link
Contributor Author

The Rust 1.34.0 failure seems unrelated to this PR - it looks like some dependencies have started relying on features from newer versions of Rust.

@Aaron1011
Copy link
Contributor Author

@tesaguri: Are there any changes that you'd like me to make?

@tesaguri
Copy link
Owner

tesaguri commented Jun 6, 2020

Sorry for the late reply. I had no time to review this.

It looks good to me. Thank you!

tesaguri added a commit that referenced this pull request Jun 6, 2020
@tesaguri tesaguri merged commit f0f3a21 into tesaguri:master Jun 6, 2020
@Aaron1011
Copy link
Contributor Author

@tesaguri: Thanks!

Would you be able to make a new point release? I'd like to roll out the rustc change as soon as possible, but there are several crates on crates.io that transitively depend on oauth1-request.

@Aaron1011 Aaron1011 deleted the fix/type-group branch June 6, 2020 03:46
@tesaguri
Copy link
Owner

tesaguri commented Jun 6, 2020

Published as v0.3.3.

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