-
Notifications
You must be signed in to change notification settings - Fork 91
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
Migrate to syn
version 2.0
#130
Conversation
bcc407f
to
b2e7217
Compare
This PR is ready for review @Lucretiel @inquisitivepenguin. |
24590a5
to
97a5ade
Compare
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.
Thanks for the contribution!
I wanted to ask about this:
currently the type override does not work due to the fact it uses the type keyword to indicate the new type. It would be great if we could rename it to new_type but that would be a major breaking change, so instead I need to write my own parser.
I'm not sure I follow where this problem is occurring, could you elaborate? If this is about the use of type as an identifier in the typeshare code itself, it can usually be circumvented by using r#type, the raw identifier syntax. I'm surprised that this would require the addition of so much duplicated parse code.
@Lucretiel let me explain, cause I see the misunderstanding here. This PR consists of 3 commits:
Here's my motivation: The part about the The rest is mostly the same code, just migrated to the new |
Ah, GitHub was hiding this part from me, it looked like you were adding just a huge amount of new code (cause it made unclear that the old |
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.
It looks like syn
1 is still coming in from a few places; it looks like they're all trivial to fix:
typeshare-annotation
: mostly a no-op, should be a trivial fixserde
: bump to at least1.0.157
, though probably just go to latest for some recent build speed improvementsthiserror
: bump to1.0.40
(for reference, you can use |
My fault, should have described my motivations better from the get-go ;). |
Updated the dependencies, this task should be mergable @Lucretiel |
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.
Sorry for the additional delays. I'd like to revert the parser changes and re-review them in a different PR, since they involve implementation changes, rather than being a direct verbatim copy of the existing code from parser.rs
.
Additionally, run cargo update -p wasm-bindgen
in the project root; this will remove syn 1.0
entirely from the Cargo.lock
.
Thanks again for all your work on this!
@Lucretiel I reverted the commit but left the helpers extraction (can revert that too if you deem it necessary). Feel free to do a review. |
The review fixes has been implemented and I believe this PR is ready to be merged @Lucretiel. |
@Lucretiel Any update on this? Its conflicting now due to the length of time. |
I'm still around to do a rebase whenever it's necessary. Probably gonna do one soon just to make it easier in the future. |
@inquisitivepenguin @CerulanLumina Any thoughts on this from you? |
Rebased it. |
@czocher Thanks for all your work on this! Could we also get the helpers extraction reverted as well, so the PR exclusively contains changes related to the migration to |
Sure @anish-1p, give me a moment. |
@anish-1p the helper extraction has been reverted. |
Thanks again! Will get this reviewed soon |
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.
This looks good to me. Only change I'd request is to make some utility functions in core/src/parser.rs
private (I don't see a reason why get_meta_items
, get_ident
, rename_all_to_case
, is_skipped
, serde_default
, serde_flatten
and get_decorators
are public to the crate).
@anish-1p I made the functions private. |
This is my take on migrating
typeshare
tosyn
version2.0
. This will allow to use theserde-derive-internals
library in the future.TODO
type
keyword to indicate the new type. It would be great if we could rename it tonew_type
but that would be a major breaking change, so instead I need to write my own parser.get_typeshare_meta_items
andget_serde_meta_items
etc.expr_to_string
,remove_dash_from_identifier
,rename_all_to_case
Closes #120