refactor(ast): re-organise #[ast] macro implementation#23045
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
Refactors the #[ast] proc-macro implementation for structs by splitting the logic into a fallible internal helper (modify_struct_impl) and a small wrapper (modify_struct) that converts internal errors into compile_error! output. This is intended to reorganize the macro implementation to better support upcoming changes.
Changes:
- Introduces
modify_struct_impl(...) -> Result<TokenStream, &'static str>and makesmodify_structan error-wrapping front-end. - Moves
STRUCTSlookup out ofreorder_struct_fieldsby passing&StructDetailsdirectly. - Keeps the main (non-foreign) struct transformation flow (reorder → repr → derive Ast → assertions) within the new helper.
4136a3d to
388af9d
Compare
d782fda to
65e49a1
Compare
65e49a1 to
c6282d4
Compare
Merge activity
|
Refactor. Just re-organise implementation of `#[ast]` macro, to make the changes in next PR work better. The only behavioral change is that we now omit some pointless attributes which were being added to `#[ast(foreign = ...)]` types. These types are just dummies, only used to communicate the layout of foreign types to the codegen, not used in actual code, so these extra attributes we were adding previously were dead weight.
c6282d4 to
da2d911
Compare

Refactor. Just re-organise implementation of
#[ast]macro, to make the changes in next PR work better.The only behavioral change is that we now omit some pointless attributes which were being added to
#[ast(foreign = ...)]types. These types are just dummies, only used to communicate the layout of foreign types to the codegen, not used in actual code, so these extra attributes we were adding previously were dead weight.