diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-11-23 00:32:51 -0500 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-11-23 02:40:57 -0500 |
| commit | 6e466efa11dc7c8cb4425a6f6a256aaaf8edd6be (patch) | |
| tree | 0b6f85dcf94a85e05f5afd77c4ce1a06d5870d91 /compiler/rustc_interface/src | |
| parent | a0d664bae6ca79c54cc054aa2403198e105190a2 (diff) | |
| download | rust-6e466efa11dc7c8cb4425a6f6a256aaaf8edd6be.tar.gz rust-6e466efa11dc7c8cb4425a6f6a256aaaf8edd6be.zip | |
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.
Diffstat (limited to 'compiler/rustc_interface/src')
0 files changed, 0 insertions, 0 deletions
