1
Fork 0

fix: Overlapping spans in delimited meta-vars

This commit is contained in:
EliseZeroTwo 2023-12-13 18:46:03 -07:00
parent 503e129328
commit 770013d315
No known key found for this signature in database
GPG key ID: FA8F56FFFE6E8B3E
3 changed files with 70 additions and 0 deletions

View file

@ -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);