Properly record metavar spans for other expansions other than TT
This commit is contained in:
parent
4c40c89c26
commit
28a997fa44
10 changed files with 58 additions and 19 deletions
|
@ -282,11 +282,13 @@ pub(super) fn transcribe<'a>(
|
|||
}
|
||||
MatchedSingle(ParseNtResult::Ident(ident, is_raw)) => {
|
||||
marker.visit_span(&mut sp);
|
||||
with_metavar_spans(|mspans| mspans.insert(ident.span, sp));
|
||||
let kind = token::NtIdent(*ident, *is_raw);
|
||||
TokenTree::token_alone(kind, sp)
|
||||
}
|
||||
MatchedSingle(ParseNtResult::Lifetime(ident, is_raw)) => {
|
||||
marker.visit_span(&mut sp);
|
||||
with_metavar_spans(|mspans| mspans.insert(ident.span, sp));
|
||||
let kind = token::NtLifetime(*ident, *is_raw);
|
||||
TokenTree::token_alone(kind, sp)
|
||||
}
|
||||
|
@ -295,6 +297,8 @@ pub(super) fn transcribe<'a>(
|
|||
// `Delimiter::Invisible` to maintain parsing priorities.
|
||||
// `Interpolated` is currently used for such groups in rustc parser.
|
||||
marker.visit_span(&mut sp);
|
||||
let use_span = nt.use_span();
|
||||
with_metavar_spans(|mspans| mspans.insert(use_span, sp));
|
||||
TokenTree::token_alone(token::Interpolated(Lrc::clone(nt)), sp)
|
||||
}
|
||||
MatchedSeq(..) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue