From: Ian Jackson Date: Fri, 10 May 2024 13:39:13 +0000 (+0100) Subject: fix and commentary X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=refs%2Fheads%2Frust-ticket-124974;p=rust-experiments.git fix and commentary --- diff --git a/macros/macros.rs b/macros/macros.rs index b532ce7..0f66a6b 100644 --- a/macros/macros.rs +++ b/macros/macros.rs @@ -7,6 +7,9 @@ pub fn dbg_dump(input: TokenStream) -> TokenStream { input } +/// Reconstructs, identically, all the `Group`s in a `TokenStream` +/// +/// (We don't bother adjusting spans.) #[proc_macro] pub fn reconstruct_groups(input: TokenStream) -> TokenStream { fn recurse(input: TokenStream) -> TokenStream { @@ -16,7 +19,7 @@ pub fn reconstruct_groups(input: TokenStream) -> TokenStream { TokenTree::Group(g) => { let delim = g.delimiter(); dbg!(&delim); - let stream = reconstruct_groups(g.stream()); + let stream = recurse(g.stream()); TokenTree::Group(Group::new(delim, stream)) }, other => other,