rust/compiler
bors 20aa182235 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.
2025-07-23 04:24:50 +00:00
..
rustc rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
rustc_abi Simplify codegen for niche-encoded variant tests 2025-07-12 04:53:24 -07:00
rustc_arena Introduce Arena::try_alloc_from_iter. 2025-04-19 01:13:18 +00:00
rustc_ast Implement AST visitors using a derive macro. 2025-07-22 01:52:34 +00:00
rustc_ast_ir Use -Wunused_crate_dependencies for compiler crates. 2025-03-20 08:59:43 +11:00
rustc_ast_lowering Rollup merge of #143430 - cjgillot:extra-lifetime-swap, r=oli-obk 2025-07-22 00:54:25 +08:00
rustc_ast_passes AST lowering: More robustly deal with relaxed bounds 2025-07-18 03:13:21 +02:00
rustc_ast_pretty parse const trait Trait 2025-07-17 18:06:26 +08:00
rustc_attr_data_structures Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU 2025-07-22 00:54:28 +08:00
rustc_attr_parsing Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU 2025-07-22 00:54:28 +08:00
rustc_baked_icu_data Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_borrowck Dont ICE on copy error being suppressed due to overflow 2025-07-21 16:07:29 +00:00
rustc_builtin_macros Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-dead 2025-07-18 14:49:19 +02:00
rustc_codegen_cranelift Update cranelift tests 2025-07-20 10:15:14 -07:00
rustc_codegen_gcc Rename tests/assembly into tests/assembly-llvm 2025-07-22 14:27:48 +02:00
rustc_codegen_llvm Rollup merge of #142097 - ZuseZ4:offload-host1, r=oli-obk 2025-07-22 00:54:24 +08:00
rustc_codegen_ssa Rename tests/codegen into tests/codegen-llvm 2025-07-22 14:28:48 +02:00
rustc_const_eval fix handling of base address for TypeId allocations 2025-07-20 22:14:27 +02:00
rustc_data_structures Fix wrong cache event query key 2025-07-07 15:16:42 +02:00
rustc_driver Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_driver_impl Rollup merge of #143719 - xizheyin:142812-1, r=jieyouxu 2025-07-18 04:27:51 +02:00
rustc_error_codes Don't reject *multiple* relaxed bounds, reject *duplicate* ones. 2025-07-18 12:24:56 +02:00
rustc_error_messages Remove unused feature gates 2025-06-28 23:36:46 +00:00
rustc_errors rename emit_unless to emit_unless_delay 2025-07-19 01:49:19 +08:00
rustc_expand Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-dead 2025-07-18 14:49:19 +02:00
rustc_feature Mitigate #[align] name resolution ambiguity regression with a rename 2025-07-19 01:42:30 +08:00
rustc_fluent_macro Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
rustc_fs_util Retry if creating temp fails with access denied 2025-04-25 11:28:36 +00:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir Remove the ptr_unique lang item 2025-07-20 09:50:58 +00:00
rustc_hir_analysis Rollup merge of #143373 - cjgillot:bare-unused-trait-imports, r=petrochenkov 2025-07-22 10:26:14 +02:00
rustc_hir_pretty parse const trait Trait 2025-07-17 18:06:26 +08:00
rustc_hir_typeck rename emit_unless to emit_unless_delay 2025-07-19 01:49:19 +08:00
rustc_incremental Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obk 2025-05-07 12:39:54 +00:00
rustc_index use div_ceil instead of manual logic 2025-07-05 10:55:42 +02:00
rustc_index_macros In rustc_mir_tranform, iterate over index newtypes instead of ints 2025-04-12 11:53:07 +00:00
rustc_infer Add alias for ArgOutlivesPredicate 2025-07-15 16:02:26 +00:00
rustc_interface Rollup merge of #142097 - ZuseZ4:offload-host1, r=oli-obk 2025-07-22 00:54:24 +08:00
rustc_lexer test(lexer): Add frontmatter unit test 2025-07-10 10:25:29 -05:00
rustc_lint Rollup merge of #141260 - LuigiPiucco:volatile-null, r=RalfJung 2025-07-20 08:56:05 +02:00
rustc_lint_defs Implement resolver warnings about reexporting private dependencies 2025-07-15 15:44:25 +02:00
rustc_llvm Rollup merge of #142097 - ZuseZ4:offload-host1, r=oli-obk 2025-07-22 00:54:24 +08:00
rustc_log Add documentation for init_logger_with_additional_layer 2025-06-12 12:11:15 +02:00
rustc_macros Implement AST visitors using a derive macro. 2025-07-22 01:52:34 +00:00
rustc_metadata Rollup merge of #144059 - LorrensP-2158466:remove-crate-loader, r=petrochenkov 2025-07-18 19:14:46 +02:00
rustc_middle Rollup merge of #143373 - cjgillot:bare-unused-trait-imports, r=petrochenkov 2025-07-22 10:26:14 +02:00
rustc_mir_build Auto merge of #143779 - JonathanBrouwer:automatically_derived_parser, r=oli-obk 2025-07-14 04:29:53 +00:00
rustc_mir_dataflow Remove support for SwitchInt edge effects in backward dataflow analyses 2025-07-11 10:56:50 +02:00
rustc_mir_transform Rename tests/codegen into tests/codegen-llvm 2025-07-22 14:28:48 +02:00
rustc_monomorphize Add opaque TypeId handles for CTFE 2025-07-09 16:37:11 +00:00
rustc_next_trait_solver update comment 2025-07-18 09:36:38 +02:00
rustc_parse Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU 2025-07-22 00:54:28 +08:00
rustc_parse_format update to literal-escaper-0.0.5 2025-07-08 10:16:44 +00:00
rustc_passes Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU 2025-07-22 00:54:28 +08:00
rustc_pattern_analysis Don't consider unstable fields always-inhabited 2025-07-20 18:23:18 +02:00
rustc_privacy Do not check privacy for RPITIT. 2025-07-17 23:59:41 +00:00
rustc_proc_macro update to literal-escaper-0.0.5 2025-07-08 10:16:44 +00:00
rustc_public use RustcPublic instead of StableMir 2025-07-18 18:49:32 +00:00
rustc_public_bridge Update docs in rustc_public_bridge 2025-07-18 18:49:12 +00:00
rustc_query_impl Remove unused allow attrs 2025-07-07 12:58:16 +00:00
rustc_query_system use is_multiple_of instead of manual modulo 2025-07-05 10:55:35 +02:00
rustc_resolve Auto merge of #144172 - lqd:revert-144013, r=petrochenkov 2025-07-19 18:20:39 +00:00
rustc_sanitizers Remove support for dyn* 2025-07-01 19:00:21 +00:00
rustc_serialize use div_ceil instead of manual logic 2025-07-05 10:55:42 +02:00
rustc_session add -Zoffload=Enable flag behind -Zunstable-options, to enable gpu (host) code generation 2025-07-18 16:24:00 -07:00
rustc_span Rollup merge of #144212 - bjorn3:remove_unique_lang_item, r=oli-obk 2025-07-22 00:54:30 +08:00
rustc_symbol_mangling use codegen_instance_attrs where an instance is (easily) available 2025-07-16 23:24:32 +02:00
rustc_target Rollup merge of #142454 - tomtor:avr-update, r=tgross35 2025-07-22 10:26:12 +02:00
rustc_thread_pool Correct comments. 2025-06-28 17:58:21 +08:00
rustc_trait_selection Consider param-env for fast path 2025-07-20 17:45:01 +00:00
rustc_traits Consider param-env for fast path 2025-07-20 17:45:01 +00:00
rustc_transmute compiler: Parse p- specs in datalayout string, allow definition of custom default data address space 2025-07-07 09:04:53 +02:00
rustc_ty_utils Rollup merge of #143793 - fmease:lta-opaq-inf-recur, r=oli-obk 2025-07-17 10:41:45 +02:00
rustc_type_ir Auto merge of #143545 - compiler-errors:coroutine-obl, r=oli-obk 2025-07-18 02:23:50 +00:00
rustc_type_ir_macros Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00