You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for your work on the 2.x release. I came across this issue when trying to update.
Starting from syn 2.x, the Parse impl of Ident rejects edition 2018 keywords such as async, so one has to use Ident::parse_any instead.
This is unfortunate when the ident is part of a more complex structure that's actually valid Rust code in edition 2015. Say you're implementing a derive macro and want to support edition 2015 code. Then parsing the macro input as a DeriveInput fails e.g. when the name of a struct field is a 2018 keyword.
Parsing arbitrary 2015-edition identifiers interchangeably with identifiers in newer edition code is not a thing I would want to do, but if there are specific unambiguous identifiers that are valuable to support in specific locations in the grammar (like async as a field of a struct) then I am open to PRs which make that parse.
The way this issue was filed, I am not sure if async in a field name of struct is specifically the case that you care about.
Thanks for your work on the 2.x release. I came across this issue when trying to update.
Starting from syn 2.x, the Parse impl of Ident rejects edition 2018 keywords such as
async
, so one has to use Ident::parse_any instead.This is unfortunate when the ident is part of a more complex structure that's actually valid Rust code in edition 2015. Say you're implementing a derive macro and want to support edition 2015 code. Then parsing the macro input as a DeriveInput fails e.g. when the name of a struct field is a 2018 keyword.
Minimal example:
This panics with the message
expected identifier
. In syn 1.x it succeeds.Other than implementing a custom parser for
DeriveInput
that uses Ident::parse_any, is there a recommended approach in this case?The text was updated successfully, but these errors were encountered: