Change Token::interpolated_to_tokenstream()
.
It is currently a method of `Token`, but it only is valid to call if `self` is a `Token::Interpolated`. This commit eliminates the possibility of misuse by changing it to an associated function that takes a `Nonterminal`, which also simplifies the call sites. This requires splitting out a new function, `nonterminal_to_string`.
This commit is contained in:
parent
f47ec2ad5b
commit
d26bf742db
4 changed files with 38 additions and 40 deletions
|
@ -178,8 +178,8 @@ impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec<Self>)>
|
|||
tt!(Punct::new('#', false))
|
||||
}
|
||||
|
||||
Interpolated(_) => {
|
||||
let stream = token.interpolated_to_tokenstream(sess, span);
|
||||
Interpolated(nt) => {
|
||||
let stream = Token::interpolated_to_tokenstream(sess, nt, span);
|
||||
TokenTree::Group(Group {
|
||||
delimiter: Delimiter::None,
|
||||
stream,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue