-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
Showing
18 changed files
with
245 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
99dd591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from sfackler
at huonw@99dd591
99dd591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging huonw/rust/macro-expander-trait = 99dd591 into auto
99dd591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huonw/rust/macro-expander-trait = 99dd591 merged ok, testing candidate = 61f788c
99dd591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/5270
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/5266
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/4359
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/4372
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/5368
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/4455
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/4463
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/5370
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/4455
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/4461
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/4525
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2255
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/5365
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/4462
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/4475
99dd591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 61f788c