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-02-14 00:27:13 -08:00
2025-04-08 23:06:31 +03:00
2025-08-05 07:10:31 +05:00
2025-08-14 13:53:57 -07:00
2025-07-31 13:55:59 +08:00
2025-07-05 00:45:24 +05:00
2025-08-06 21:29:26 +02:00
2025-07-15 12:00:46 +08:00
2025-04-08 23:06:31 +03:00
2024-12-10 11:34:13 +08:00
2024-12-17 19:09:00 +08:00
2024-12-17 19:09:00 +08:00
2025-08-05 07:10:31 +05:00
2025-08-05 07:10:31 +05:00
2025-08-05 07:10:31 +05:00
2025-08-05 07:10:31 +05:00
2025-08-05 07:10:31 +05:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-06-13 18:13:34 +02:00
2025-06-13 18:13:34 +02:00
2025-06-13 18:13:34 +02:00
2024-11-16 20:03:31 +00:00
2025-02-10 20:21:39 +00:00
2025-07-01 16:10:05 +02:00
2025-08-11 17:02:32 +00:00
2024-09-18 20:37:56 +02:00
2024-12-11 16:23:04 +01:00
2024-12-02 16:50:44 +00:00
2024-12-02 16:50:44 +00:00
2025-07-15 12:00:46 +08:00
2025-07-15 12:00:46 +08:00
2025-06-11 17:11:58 +02:00
2025-06-11 17:11:58 +02:00
2025-03-01 22:02:46 +08:00
2025-03-01 22:02:46 +08:00
2025-06-03 13:28:38 +02:00
2025-06-26 13:46:45 +00:00
2025-06-29 04:56:28 +02:00
2025-04-18 15:57:29 +02:00
2024-12-13 07:10:20 +11:00
2025-02-14 00:44:10 -08:00
2025-03-07 17:55:08 +00:00
2025-04-17 19:45:28 +08:00
2025-04-03 11:08:55 +03:00
2024-12-10 18:17:24 +00:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-03-20 16:01:13 +00:00
2025-03-20 16:02:24 +00:00
2025-01-24 01:19:50 +00:00
2025-02-10 20:21:39 +00:00
2025-04-03 21:41:58 +00:00
2025-08-11 16:58:21 -05:00
2025-08-11 16:58:21 -05:00
2025-04-18 15:57:29 +02:00
2025-07-18 20:34:58 +08:00
2025-07-18 20:34:58 +08:00
2025-05-07 22:56:14 +08:00
2025-05-07 22:56:14 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-02-19 17:26:13 +00:00
2025-02-19 17:26:13 +00:00
2025-02-19 17:26:13 +00:00
2025-02-19 17:26:13 +00:00
2025-06-16 23:07:11 +08:00
2025-06-16 23:07:11 +08:00
2025-07-05 00:45:24 +05:00
2025-07-25 20:38:54 +05:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-06-03 11:45:58 +02:00
2025-06-03 11:45:58 +02:00
2024-11-16 20:03:31 +00:00
2025-02-21 00:41:17 +00:00
2025-07-31 21:25:49 +05:00
2025-02-10 20:21:39 +00:00
2025-02-25 16:56:04 +00:00
2025-04-22 00:53:12 +05:00
2025-04-22 00:53:12 +05:00
2025-04-22 00:53:12 +05:00
2025-04-22 00:53:12 +05:00
2025-04-22 00:53:12 +05:00
2025-04-03 21:41:58 +00:00
2025-06-03 11:45:58 +02:00
2025-02-21 00:41:17 +00:00
2025-02-14 00:44:10 -08:00
2025-02-21 20:44:35 +00:00
2025-02-21 20:44:35 +00:00
2025-02-21 20:44:35 +00:00
2025-02-21 20:44:35 +00:00
2025-04-02 06:20:35 +11:00
2025-04-02 06:20:35 +11:00
2025-04-08 23:06:31 +03:00
2025-08-07 21:39:00 +00:00
2025-05-03 22:49:23 +03:00
2025-05-03 22:49:23 +03:00
2025-02-10 20:21:39 +00:00
2025-01-04 11:41:51 +01:00
2025-01-04 11:41:51 +01:00
2025-04-03 21:41:58 +00:00
2025-02-10 20:21:39 +00:00
2025-06-03 11:45:58 +02:00
2025-06-03 11:45:58 +02:00
2024-10-11 11:30:08 -04:00
2024-10-11 11:30:08 -04:00
2025-04-03 21:41:58 +00:00
2025-02-10 20:21:39 +00:00
2025-04-03 21:41:58 +00:00
2025-02-10 20:21:39 +00:00
2025-04-03 21:41:58 +00:00
2025-04-03 21:41:58 +00:00
2025-08-09 16:27:20 +05:00
2024-11-22 11:12:15 -08:00
2025-04-03 21:41:58 +00:00
2025-04-03 21:41:58 +00:00
2025-04-03 21:41:58 +00:00
2025-04-09 15:01:14 +10:00
2025-04-09 15:01:14 +10:00
2025-04-09 15:01:14 +10:00
2025-04-09 15:01:14 +10:00
2024-11-29 06:10:15 +11:00
2024-11-03 18:59:31 +00:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-04-03 11:08:55 +03:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-07-10 18:47:20 +05:00
2025-04-08 23:06:31 +03:00
2025-04-08 23:06:31 +03:00
2025-02-10 20:21:39 +00:00
2025-04-08 23:06:31 +03:00
2025-08-14 21:31:47 +08:00
2025-08-14 21:31:47 +08:00
2025-04-03 21:41:58 +00:00
2025-04-03 21:41:58 +00:00
2025-04-03 21:41:58 +00:00
2025-01-07 16:04:14 +01:00
2025-01-07 16:04:14 +01:00
2025-07-31 13:55:59 +08:00
2025-04-10 09:56:37 +02:00
2025-07-31 13:55:59 +08:00
2024-11-16 20:03:31 +00:00
2025-08-14 21:31:47 +08:00
2025-02-10 20:21:39 +00:00
2025-05-16 12:40:04 +02:00
2025-05-16 12:40:04 +02:00
2025-05-16 12:40:04 +02:00
2025-02-22 18:30:14 +00:00
2025-02-10 20:21:39 +00:00
2025-03-29 13:30:20 +03:00
2025-03-29 13:30:20 +03:00
2025-02-14 00:44:10 -08:00
2025-01-24 01:19:50 +00:00
2025-01-24 01:19:50 +00:00
2025-02-03 10:39:32 -05:00
2025-02-03 10:39:32 -05:00
2025-01-22 00:52:27 +00:00
2025-01-22 00:52:27 +00:00
2025-06-30 11:23:01 +05:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-07-01 15:29:29 +05:00
2024-10-11 11:30:08 -04:00
2024-10-11 11:30:08 -04:00
2025-02-10 20:21:39 +00:00
2025-08-14 21:31:47 +08:00
2025-03-21 22:55:00 -06:00
2025-04-25 17:02:59 +05:00
2025-04-25 17:02:59 +05:00
2025-04-25 17:02:59 +05:00
2024-11-26 02:50:48 +08:00
2025-08-14 21:31:47 +08:00
2024-11-23 08:57:25 -07:00
2025-05-09 15:31:27 +00:00
2024-11-24 19:42:33 +01:00
2024-11-24 19:42:33 +01:00
2024-11-23 08:57:25 -07:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2024-12-29 11:03:06 -08:00
2025-06-03 11:45:58 +02:00
2025-06-03 11:45:58 +02:00
2025-06-28 17:04:16 +05:00
2025-04-08 23:06:31 +03:00
2025-04-03 21:41:58 +00:00
2025-04-18 15:57:29 +02:00
2025-04-18 15:57:29 +02:00
2025-04-03 21:41:58 +00:00
2024-12-09 21:55:13 +00:00
2024-12-09 21:55:13 +00:00
2025-03-25 15:16:16 +01:00
2025-03-25 15:16:16 +01:00
2025-02-10 20:21:39 +00:00
2024-11-17 22:30:11 +00:00
2025-02-10 20:21:39 +00:00
2025-08-14 21:31:36 +08:00
2025-08-14 21:31:47 +08:00
2024-11-17 22:30:11 +00:00
2024-11-17 22:30:11 +00:00
2025-07-13 00:03:31 +05:00
2025-05-14 13:32:59 +01:00
2025-05-14 13:32:59 +01:00
2025-06-03 13:28:38 +02:00
2025-02-10 20:21:39 +00:00
2025-04-03 21:41:58 +00:00
2025-04-15 10:08:49 +02:00
2025-04-15 10:08:49 +02:00
2025-07-01 19:00:21 +00:00
2025-07-01 19:00:21 +00:00
2025-04-15 10:08:36 +02:00
2025-04-15 10:08:49 +02:00
2025-04-15 10:08:36 +02:00
2025-04-15 10:08:49 +02:00
2025-04-15 10:08:49 +02:00
2025-07-18 12:13:19 +02:00
2025-07-24 15:08:21 +02:00
2024-09-21 20:29:22 +03:00
2024-09-21 20:29:22 +03:00
2024-09-21 20:29:22 +03:00
2024-09-21 20:07:52 +03:00
2024-09-21 20:07:52 +03:00
2024-09-21 20:07:52 +03:00
2025-04-24 02:57:10 +02:00
2025-03-25 15:15:21 +01:00
2025-03-25 15:15:21 +01:00
2024-12-04 19:52:53 +00:00
2024-12-04 19:52:53 +00:00
2025-07-31 13:55:59 +08:00
2025-07-05 03:46:08 +05:00
2025-07-05 03:46:08 +05:00
2025-07-05 03:46:08 +05:00
2025-03-29 13:30:20 +03:00
2025-03-29 13:30:20 +03:00
2025-07-23 13:48:04 +02:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-05-27 15:57:41 +00:00
2025-05-27 15:57:41 +00:00
2025-06-30 11:50:19 +05:00
2025-06-30 11:23:01 +05:00
2025-02-10 20:21:39 +00:00
2024-11-15 17:43:29 +00:00
2024-11-15 17:43:29 +00:00
2025-02-10 20:21:39 +00:00
2025-02-14 00:44:10 -08:00
2025-03-29 13:30:20 +03:00
2025-04-13 21:48:53 +03:00
2025-04-03 11:08:55 +03:00
2025-04-13 21:48:53 +03:00
2025-04-03 11:08:55 +03:00
2025-04-03 21:41:58 +00:00