]> git.lizzy.rs Git - rust.git/commit
Auto merge of #83339 - Aaron1011:deep-recollect, r=petrochenkov
authorbors <bors@rust-lang.org>
Sun, 21 Mar 2021 13:00:22 +0000 (13:00 +0000)
committerbors <bors@rust-lang.org>
Sun, 21 Mar 2021 13:00:22 +0000 (13:00 +0000)
commited75d0686e1ab674636e784268b4b7f5e03c53de
tree067d2aab72f6e1a4ab91a009e840a1fbe430719b
parentbbf07c0b4f210ced7bd2785ab554e0d805644235
parent6d7294a00c3f831ed7d60a530911bff67f4e54ba
Auto merge of #83339 - Aaron1011:deep-recollect, r=petrochenkov

Perform 'deep recollection' in test helper macros

Currently, the print helper macro performs 'recollection' by doing
`token_stream.into_iter().collect()`. However, this will not affect
nonterminals that occur nested inside delimited groups, since the
wrapping delimited group will be left untouched.

This commit adds 'deep recollection', which recursively recollects every
delimited group in the token stream. As with normal recollection, we
only print out something if deep recollection results in a different
stringified token stream.

This is useful for catching bugs where we update the AST of a
nonterminal (which affects pretty-printing), but do not update the
attatched `TokenStream`