mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
fix: Fix macro transcriber emitting incorrect lifetime tokens
This commit is contained in:
parent
ddf105b646
commit
c990587593
4 changed files with 73 additions and 6 deletions
|
@ -101,10 +101,20 @@ impl<S: Span> Bindings<S> {
|
|||
})))
|
||||
}
|
||||
MetaVarKind::Lifetime => {
|
||||
Fragment::Tokens(tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
|
||||
text: SmolStr::new_static("'missing"),
|
||||
span,
|
||||
})))
|
||||
Fragment::Tokens(tt::TokenTree::Subtree(tt::Subtree {
|
||||
delimiter: tt::Delimiter::invisible_spanned(span),
|
||||
token_trees: Box::new([
|
||||
tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct {
|
||||
char: '\'',
|
||||
span,
|
||||
spacing: tt::Spacing::Joint,
|
||||
})),
|
||||
tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
|
||||
text: SmolStr::new_static("missing"),
|
||||
span,
|
||||
})),
|
||||
]),
|
||||
}))
|
||||
}
|
||||
MetaVarKind::Literal => {
|
||||
Fragment::Tokens(tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
|
||||
|
|
|
@ -700,10 +700,12 @@ impl<S> SynToken<S> {
|
|||
}
|
||||
|
||||
impl<SpanMap, S: std::fmt::Debug> SrcToken<Converter<SpanMap, S>, S> for SynToken<S> {
|
||||
fn kind(&self, ctx: &Converter<SpanMap, S>) -> SyntaxKind {
|
||||
fn kind(&self, _ctx: &Converter<SpanMap, S>) -> SyntaxKind {
|
||||
match self {
|
||||
SynToken::Ordinary(token) => token.kind(),
|
||||
SynToken::Punct { .. } => SyntaxKind::from_char(self.to_char(ctx).unwrap()).unwrap(),
|
||||
SynToken::Punct { token, offset: i } => {
|
||||
SyntaxKind::from_char(token.text().chars().nth(*i).unwrap()).unwrap()
|
||||
}
|
||||
SynToken::Leaf(_) => {
|
||||
never!();
|
||||
SyntaxKind::ERROR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue