mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Special case underscore in mbe meta op
This commit is contained in:
parent
b33453f844
commit
b5c29af02a
2 changed files with 45 additions and 2 deletions
|
@ -101,8 +101,15 @@ fn next_op<'a>(
|
|||
Op::Repeat { subtree, separator, kind }
|
||||
}
|
||||
tt::TokenTree::Leaf(leaf) => match leaf {
|
||||
tt::Leaf::Punct(_) => {
|
||||
return Err(ExpandError::UnexpectedToken);
|
||||
tt::Leaf::Punct(punct) => {
|
||||
static UNDERSCORE: SmolStr = SmolStr::new_inline("_");
|
||||
|
||||
if punct.char != '_' {
|
||||
return Err(ExpandError::UnexpectedToken);
|
||||
}
|
||||
let name = &UNDERSCORE;
|
||||
let kind = eat_fragment_kind(src, mode)?;
|
||||
Op::Var { name, kind }
|
||||
}
|
||||
tt::Leaf::Ident(ident) => {
|
||||
let name = &ident.text;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue