-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Parsing keywords in Meta
-path positions fails with syn v2
#1414
Comments
I think this is behaving correctly, as Rust macro_rules also do not consider macro_rules! meta {
($m:meta) => {};
}
meta!(as = "FooBar"); error: expected identifier, found keyword `as`
--> src/lib.rs:5:7
|
5 | meta!(as = "FooBar");
| ^^ expected identifier, found keyword
|
help: escape `as` to use it as an identifier
|
5 | meta!(r#as = "FooBar");
| ++ |
I don't think the example you gives proves that this is behaving correctly, because it's not actually parsing the same thing. The following is accepted by macro_rules: macro_rules! meta {
($m:meta) => {};
}
meta!(serde_as(as = "FooBar")); |
Yes, that is accepted by syn::Meta as well. |
Okay, so the problem I guess is that we're trying to parse the content of the element as |
I have an attribute like
#[serde_as(as = "FooBar")]
. While trying to use syn v2 inserde_with
, I see many errors like this (log):The issue seems to be that the
Path
types inMetaNameValue
does not allow keywords.This does prevent me from upgrading syn in
serde_with
, which I tried TedDriggs/darling#226 and jonasbb/serde_with#578.This parses with syn v1, but panics with
expected path
for v2.The text was updated successfully, but these errors were encountered: