-
Notifications
You must be signed in to change notification settings - Fork 902
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
[GSoC24] Implement rewrite_result
for AST nodes
#6206
Labels
GSoC
Google Summer of Code
Comments
@rustbot claim |
This was referenced Jun 24, 2024
14 tasks
This was referenced Jul 10, 2024
List of
|
This was referenced Jul 12, 2024
This was referenced Jul 20, 2024
This was referenced Aug 3, 2024
This was referenced Aug 23, 2024
TODO for propagating errorsUpdate functions that format top level items to return RewriteResultThese are the list of functions that I have to update.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue tracks the necessary tasks to implement
rewrite_result
for all the nodes that haverewrite
implementation.Background
Current
rewrite
method returns Option, which means that it gives None without any context when formatting fails. To improve tracking the context of formatting failures, we plan to add a new methodrewrite_result
in Rewrite trait and gradually replacerewrite
withrewrite_result
.Target AST nodes
Below is the list of structs that currently implement the rewrite method. Most of these structs are rustc AST node, but it may be rustfmt representation of AST nodes (ex. Chain). Each task requires both implementing
rewrite_result
for that node and then modifyingrewrite
body with callingrewrite_result
. Still,rewrite
signature will remain the same and the return value ofrewrite_result
will be squashed into Option until we are ready to propagate Result upwards.rewrite_***
on the right are the functions that need to be modified to implementrewrite_result
for corresponding ast node.attr.rs
chains.rs
expr.rs
rewrite_block
andrewrite_closure
#6235imports.rs
items.rs
macros.rs
rewrite_macro
matches.rs
overflow.rs
Expr, GenericParam, MacroArg, NestedMetaItem, SegmentParam
FieldDef, TuplePatField, Ty, Pat impl rewrite_result for ControlFlow, Stmt, update rewrite_index #6291
patterns.rs
stmt.rs
types.rs
Future Tasks
Future tasks have two directions: one is propagating errors upward, and the other is generating a Result from downward that can potentially cause failure. Corresponding gh issues will be created after the tasks for this issue are done.
Reference
This issue is part of the Google Summer of Code project. For detailed description, see GSoC project page.
The text was updated successfully, but these errors were encountered: