Skip to content
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

syntax: unify all MacResult's into a single trait. #13527

Merged
merged 1 commit into from
Apr 16, 2014

Commits on Apr 16, 2014

  1. syntax: unify all MacResult's into a single trait.

    There's now one unified way to return things from a macro, instead of
    being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr`
    variants of the `MacResult` enum. This does simplify the logic handling
    the expansions, but the biggest value of this is it makes macros in (for
    example) type position easier to implement, as there's this single thing
    to modify.
    
    By my measurements (using `-Z time-passes` on libstd and librustc etc.),
    this appears to have little-to-no impact on expansion speed. There are
    presumably larger costs than the small number of extra allocations and
    virtual calls this adds (notably, all `macro_rules!`-defined macros have
    not changed in behaviour, since they had to use the `AnyMacro` trait
    anyway).
    huonw committed Apr 16, 2014
    5 Configuration menu
    Copy the full SHA
    99dd591 View commit details
    Browse the repository at this point in the history