diff options
| author | EliseZeroTwo <mail@elise.moe> | 2023-12-13 18:46:03 -0700 |
|---|---|---|
| committer | EliseZeroTwo <mail@elise.moe> | 2023-12-13 18:46:03 -0700 |
| commit | 770013d315e9a905e92794876b604568d2fb568e (patch) | |
| tree | 208644b367b7dd4a917adf6b6876ad7de3da5d92 /compiler | |
| parent | 503e129328080e924c0ddfca6abf4c2812580102 (diff) | |
| download | rust-770013d315e9a905e92794876b604568d2fb568e.tar.gz rust-770013d315e9a905e92794876b604568d2fb568e.zip | |
fix: Overlapping spans in delimited meta-vars
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_expand/src/mbe/macro_rules.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 19734394382..0b3ef829219 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -236,6 +236,13 @@ fn expand_macro<'cx>( target_sp.open = source_sp.open.with_ctxt(ctxt); target_sp.close = source_sp.close.with_ctxt(ctxt); } + ( + TokenTree::Delimited(target_sp, ..), + mbe::TokenTree::MetaVar(source_sp, ..), + ) => { + target_sp.open = source_sp.with_ctxt(ctxt); + target_sp.close = source_sp.with_ctxt(ctxt).shrink_to_hi(); + } _ => { let sp = rhs_tt.span().with_ctxt(ctxt); tt.set_span(sp); |
