-
-
Notifications
You must be signed in to change notification settings - Fork 659
feat(macros): Upgrade syn to v2 #1559
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
Conversation
| [dependencies] | ||
| bae = { version = "0.1", default-features = false } | ||
| syn = { version = "1", default-features = false, features = ["parsing", "proc-macro", "derive", "printing"] } | ||
| bae2 = { version = "1", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since bae crate is no longer maintained and it is required that bae is upgrade to syn v2 too, so I made a fork of bae and published to crates.io.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any alternative for bae?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we adopt darling? Just like #1412
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@billy1624
I think we can adopt darling after TedDriggs/darling#226 got merged. Also it is not so difficult to parse attributes without bae or darling, thanks to parse_nested_meta API. In fact, major of sea_orm attributes are parsed manually without using bae.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we use Darling since it has nicer errors when you get a name wrong
| continue; | ||
| } | ||
| } else { | ||
| if !attr.path().is_ident("sea_orm") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use this shorthand syntax.
| if let Expr::Lit(exprlit) = &nv.value { | ||
| if let Lit::Str(litstr) = &exprlit.lit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of MetaNameValue is now Expr, so we need to check whether the value is Lit or not first.
|
Hey @siketyan, thanks for the hard work!! Perhaps we can rewrite all macros after TedDriggs/darling#226 merged and released? I will convert this into a draft PR for now. |
|
@billy1624 Yes, maybe. I saw your PoC. But I do not know we can or can not rewrite Btw I can work on this after the syn's PR got merged. |
|
+1 on using darling for attributes. they seem to have more helpful error messages for mistyped attribute names |
|
I totally agree to use darling instead. TedDriggs/darling#226 has been merged and we're ready to migrate. |
PR Info
New Features
N/A
Bug Fixes
N/A
Breaking Changes
N/A
Changes