Skip to content

Token tree parsing is inefficient in cases of nested macros #3073

Closed
@paulstansifer

Description

@paulstansifer

In a case like this:

m!{ 4 + m!{ 2+ 3 } }

...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_readers 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 the maybe_whole! macro works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsI-compiletimeIssue: Problems and improvements with respect to compile times.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions