-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Token tree parsing is inefficient in cases of nested macros #3073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Bug triage 2013jun24. This is still a problem. It is relatively easy to make examples that illustrate the issue described here, such as One distinction worth making is whether the reparsing occurs solely (if repeatedly) on source code inputs, or if it also happens when recursively expanding the output of a macro expansion. I was sufficiently curious about this that I made a couple more examples (also linked on the gist above) that construct the large syntax trees (one that matches the size of |
I don't have anything to add except some updated timing:
|
Accepted for P-low. |
Triage: the gist is out of date fairly badly, after doing the easy updates I'm getting
|
@steveklabnik should be able to replace the |
@steveklabnik I don't think this occurs anymore, unless I messed something up when getting it to compile. Using this updated version:
On the latest nightly, rustc 1.5.0-nightly (e0e2627 2015-10-27). |
@Toby-s thanks! Anyone else, if this is still happening, please let us know. |
Nice! |
format_strings: take into account newline occurring within a rewritten line
run the cron job a bit earlier
Upgrade Rust toolchain to 2024-03-14 Resolves rust-lang#3073 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
In a case like this:
...the body of the innermost invocation gets parsed as a token tree n times, where n is the nesting depth of the macros.
What should happen is the parser should tell the lexer "I'm looking for a token tree; you don't happen to be operating on a token tree already by any chance?".
string_reader
s will say "No", and tt_readers will say "Why yes; here's the whole next subtree." In parse.rs,parse_token_tree
will use this information similarly to the way that the themaybe_whole!
macro works.The text was updated successfully, but these errors were encountered: