-
Notifications
You must be signed in to change notification settings - Fork 504
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
Transition to quote
+ syn
for code generation.
#1026
Open
gibbz00
wants to merge
62
commits into
tokio-rs:master
Choose a base branch
from
gibbz00:quote_experimentation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Apr 14, 2024
gibbz00
force-pushed
the
quote_experimentation
branch
2 times, most recently
from
April 20, 2024 10:18
10ca7c3
to
c80addc
Compare
Goal is to hopefully improve code generation logic readability.
Feels weird adding so much manual formatting and offer a auto format option. Users not using the format option would still be receiving formatted output, albeit not done as well as `prettyplease` would do.
* Removes the need a bunch of invariant runtime assertions. * Adds `pretty_assertions` dev dependency for simplied test failure debugging.
* scoped and in order of usage
Also moves code_generator.rs to code_generator/mod.rs
gibbz00
force-pushed
the
quote_experimentation
branch
from
April 20, 2024 10:19
c80addc
to
b75f7a8
Compare
gibbz00
changed the title
WIP: Transition to
Transition to Apr 21, 2024
quote
+ syn
for code generation.quote
+ syn
for code generation.
I suggest the following to make reviewing easier:
|
Hi, thank you for starting to look into this pr 😊 I'll see what I can do during the weekend. |
caspermeijn
reviewed
Aug 9, 2024
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.
- You have done some work to reorganize
code_generator
into modules. I think that work is not yet merged into this branch. As the diff in Github is still not useful - It seems
FullyQualifiedName
andpretty_assertions
can be easily split into separate PRs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apil 13
Throwing this out here ASAP as a draft so that others can become aware of it. Will most definitely clash with PRs such as #1019.
Built upon #1020.(rebased)Will create a proper write-up once things become presentable.
Update (14 April)
Post
quote
+syn
POC made separation of concerns a lot clearer, which lead to a bunch of module splitting. Might be worth trying to send for these as separate PRs, which this draft then builds upon. Ex. placingunescape_c_escape_string
and its unit tests in a separate module.Update (21 April)
Think this is ready to be reviewed now.
Goals:
Assessment:
Still plenty left to be done. Refrained from making larger API changes before input from others, in addition to the experience gained from trying to add JSON mapping.
Similar to outcome of 1, but here an example of what has changed:
Example:
Before
After
Other examples
One takeaway it that this PR removes manual indentation handling, delegating it to the
format
feature.Possible future "improvements" which lead to breaking changes.
ServiceGenerator
API to pass a tokenTokenStream
/syn::Item
rather thanbuf: &mut String
. See tonic's usage: https://github.com/hyperium/tonic/blob/eeb3268f71ae5d1107c937392389db63d8f721fb/tonic-build/src/prost.rs#L247-L276config.field_attribute("in", "#[serde(rename = \"in\")]");
PR splitting
Waiting for #1029 and #1030 to get merged before rebasing this one on top of them. Unsure how much else there's to split up.