Files
rust/tests/ui/parser
Stuart Cook 152b43c7cb Rollup merge of #145208 - joshtriplett:mbe-derive, r=petrochenkov
Implement declarative (`macro_rules!`) derive macros (RFC 3698)

This is a draft for review, and should not be merged yet.

This is layered atop https://github.com/rust-lang/rust/pull/145153 , and has
only two additional commits atop that. The first handles parsing and provides a
test for various parse errors. The second implements expansion and handles
application.

This implements RFC 3698, "Declarative (`macro_rules!`) derive macros".
Tracking issue: https://github.com/rust-lang/rust/issues/143549

This has one remaining issue, which I could use some help debugging: in
`tests/ui/macros/macro-rules-derive-error.rs`, the diagnostics for
`derive(fn_only)` (for a `fn_only` with no `derive` rules) and
`derive(ForwardReferencedDerive)` both get emitted twice, as a duplicate
diagnostic.

From what I can tell via adding some debugging code,
`unresolved_macro_suggestions` is getting called twice from
`finalize_macro_resolutions` for each of them, because
`self.single_segment_macro_resolutions` has two entries for the macro, with two
different `parent_scope` values. I'm not clear on why that happened; it doesn't
happen with the equivalent code using attrs.

I'd welcome any suggestions for fixing this.
2025-08-18 15:31:10 +10:00
..
2025-04-03 21:41:58 +00:00
2025-04-03 21:41:58 +00:00
2025-08-14 13:53:57 -07:00
2025-07-05 00:45:24 +05:00
2024-12-10 11:34:13 +08:00
2025-07-25 20:38:54 +05:00
2024-11-16 20:03:31 +00:00
2025-07-31 21:25:49 +05:00
2024-10-11 11:30:08 -04:00
2025-08-09 16:27:20 +05:00
2024-11-29 06:10:15 +11:00
2025-01-07 16:04:14 +01:00
2025-01-07 16:04:14 +01:00
2025-07-01 15:29:29 +05:00
2025-04-25 17:02:59 +05:00
2024-11-24 19:42:33 +01:00
2024-11-24 19:42:33 +01:00
2024-09-21 20:07:52 +03:00