diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-08-18 15:31:10 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-18 15:31:10 +1000 |
| commit | 152b43c7cb9705b071394e4deb40d82e20c12552 (patch) | |
| tree | 370ec48bb030f5320f6fde9392bd12202f661d53 /compiler/rustc_span/src/symbol.rs | |
| parent | d92e1fe8d7c6d08e2921c40cfa38b625cb00a76d (diff) | |
| parent | 354fcf2b52119d938b3181bd6cbc3be1929138df (diff) | |
| download | rust-152b43c7cb9705b071394e4deb40d82e20c12552.tar.gz rust-152b43c7cb9705b071394e4deb40d82e20c12552.zip | |
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.
Diffstat (limited to 'compiler/rustc_span/src/symbol.rs')
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 42ca2cb4175..3ed483db3c4 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1329,6 +1329,7 @@ symbols! { macro_attr, macro_attributes_in_derive_output, macro_concat, + macro_derive, macro_escape, macro_export, macro_lifetime_matcher, |
