Skip to content

Commit 1cb804b

Browse files
committed
Add spacing information to delimiters.
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
1 parent 1b9bf8a commit 1cb804b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/macros.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ struct MacroArgParser {
708708
fn last_tok(tt: &TokenTree) -> Token {
709709
match *tt {
710710
TokenTree::Token(ref t, _) => t.clone(),
711-
TokenTree::Delimited(delim_span, delim, _) => Token {
711+
TokenTree::Delimited(delim_span, _, delim, _) => Token {
712712
kind: TokenKind::CloseDelim(delim),
713713
span: delim_span.close,
714714
},
@@ -925,7 +925,7 @@ impl MacroArgParser {
925925
self.add_meta_variable(&mut iter)?;
926926
}
927927
TokenTree::Token(ref t, _) => self.update_buffer(t),
928-
&TokenTree::Delimited(_delimited_span, delimited, ref tts) => {
928+
&TokenTree::Delimited(_dspan, _spacing, delimited, ref tts) => {
929929
if !self.buf.is_empty() {
930930
if next_space(&self.last_tok.kind) == SpaceState::Always {
931931
self.add_separator();
@@ -1167,7 +1167,7 @@ impl<'a> MacroParser<'a> {
11671167
let tok = self.toks.next()?;
11681168
let (lo, args_paren_kind) = match tok {
11691169
TokenTree::Token(..) => return None,
1170-
&TokenTree::Delimited(delimited_span, d, _) => (delimited_span.open.lo(), d),
1170+
&TokenTree::Delimited(delimited_span, _, d, _) => (delimited_span.open.lo(), d),
11711171
};
11721172
let args = TokenStream::new(vec![tok.clone()]);
11731173
match self.toks.next()? {

0 commit comments

Comments
 (0)