rust/compiler
bors cb56a4420c Auto merge of #79338 - Aaron1011:fix/token-reparse-cache, r=petrochenkov
Cache pretty-print/retokenize result to avoid compile time blowup

Fixes #79242

If a `macro_rules!` recursively builds up a nested nonterminal
(passing it to a proc-macro at each step), we will end up repeatedly
pretty-printing/retokenizing the same nonterminals. Unfortunately, the
'probable equality' check we do has a non-trivial cost, which leads to a
blowup in compilation time.

As a workaround, we cache the result of the 'probable equality' check,
which eliminates the compilation time blowup for the linked issue. This
commit only touches a single file (other than adding tests), so it
should be easy to backport.

The proper solution is to remove the pretty-print/retokenize hack
entirely. However, this will almost certainly break a large number of
crates that were relying on hygiene bugs created by using the reparsed
`TokenStream`. As a result, we will definitely not want to backport
such a change.
2020-11-26 22:02:45 +00:00
..
2020-11-20 00:00:00 +00:00
2020-11-22 13:45:14 +00:00
2020-10-30 10:13:41 -04:00
2020-11-25 09:45:33 -08:00
2020-11-22 13:45:14 +00:00
2020-11-25 13:15:48 -08:00
2020-11-22 20:32:36 -05:00
2020-11-21 09:06:45 +01:00
2020-11-24 20:08:54 -08:00