Skip to content

Commit 7f57a01

Browse files
Merge #7808
7808: Fix assert split exprs on comma r=edwin0cheng a=edwin0cheng bors r+ Co-authored-by: Edwin Cheng <[email protected]>
2 parents 76404c4 + 30402be commit 7f57a01

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

crates/hir_expand/src/builtin_macro.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,25 +182,10 @@ fn assert_expand(
182182
// ```,
183183
// which is wrong but useful.
184184

185-
let mut args = Vec::new();
186-
let mut current = Vec::new();
187-
for tt in tt.token_trees.iter().cloned() {
188-
match tt {
189-
tt::TokenTree::Leaf(tt::Leaf::Punct(p)) if p.char == ',' => {
190-
args.push(current);
191-
current = Vec::new();
192-
}
193-
_ => {
194-
current.push(tt);
195-
}
196-
}
197-
}
198-
if !current.is_empty() {
199-
args.push(current);
200-
}
185+
let args = parse_exprs_with_sep(tt, ',');
201186

202187
let arg_tts = args.into_iter().flat_map(|arg| {
203-
quote! { &(##arg), }
188+
quote! { &(#arg), }
204189
}.token_trees).collect::<Vec<_>>();
205190

206191
let expanded = quote! {

0 commit comments

Comments
 (0)