diff options
| author | bors <bors@rust-lang.org> | 2025-07-23 04:24:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-07-23 04:24:50 +0000 |
| commit | 20aa182235d6b27ecee519f1d18ee30f0d1c4a61 (patch) | |
| tree | b7ff14e7715b6cf5e274e44c73e5b6c7cbab66c1 /tests/ui/codegen/equal-pointers-unequal/as-cast/zero.rs | |
| parent | a7a1618e6c835f1f00940ad72203d05808209a0d (diff) | |
| parent | 3c81faec23161d3f997666e90e6e34747ace6d28 (diff) | |
| download | rust-20aa182235d6b27ecee519f1d18ee30f0d1c4a61.tar.gz rust-20aa182235d6b27ecee519f1d18ee30f0d1c4a61.zip | |
Auto merge of #143897 - cjgillot:derive-walk, r=petrochenkov
Implement AST visitors using a derive macro. AST visitors are large and error-prone beasts. This PR attempts to write them using a derive macro. The design uses three traits: `Visitor`, `Visitable`, `Walkable`. - `Visitor` is the trait implemented by downstream crates, it lists `visit_stuff` methods, which call `Walkable::walk_ref` by default; - `Walkable` is derived using the macro, the generated `walk_ref` method calls `Visitable::visit` on each component; - `Visitable` is implemented by `common_visitor_and_walkers` macro, to call the proper `Visitor::visit_stuff` method if it exists, to call `Walkable::walk_ref` if there is none. I agree this is quite a lot of spaghetti macros. I'm open to suggestions on how to reduce the amount of boilerplate code. If this PR is accepted, I believe the same design can be used for the HIR visitor.
Diffstat (limited to 'tests/ui/codegen/equal-pointers-unequal/as-cast/zero.rs')
0 files changed, 0 insertions, 0 deletions
