Make bare underscore token an Ident rather than Punct in proc-macro

This commit is contained in:
Kevin Mehall 2021-03-20 12:18:57 -06:00
parent 5cc8ad0c4a
commit 0a0e22235b
6 changed files with 24 additions and 12 deletions

View file

@ -805,5 +805,14 @@ mod tests {
let t2 = TokenStream::from_str("(a);").unwrap();
assert_eq!(t2.token_trees.len(), 2);
assert_eq!(t2.token_trees[0], subtree_paren_a);
let underscore = TokenStream::from_str("_").unwrap();
assert_eq!(
underscore.token_trees[0],
tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
text: "_".into(),
id: tt::TokenId::unspecified(),
}))
);
}
}