Uh oh!
There was an error while loading. Please reload this page.
Allow syntax extensions which modify and decorate - #33738
Conversation
rust-highfive
commented
May 19, 2016
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
afadda2 to
1eab42eComparesfackler
commented
May 19, 2016
This has been something I've been meaning to do for a while - I think the whole split into decorators and modifiers was a bad design decision on my part. To that end, I'd like to move towards removing the other variants and making this the only one. cc @nrc |
There was a problem hiding this comment.
Seems like we can drop the return type and just have implementors push all of the things they're creating/preserving into push?
There was a problem hiding this comment.
That is a good idea, I'm adding this in now.
519c8de to
9251609Compare57c0733 to
83a8e22Comparebors
commented
May 26, 2016
☔ The latest upstream changes (presumably #33766) made this pull request unmergeable. Please resolve the merge conflicts. |
sfackler
commented
May 26, 2016
Looks like travis is failing and it needs a rebase. Looks good to me otherwise though. r? @nrc |
nrc
commented
May 27, 2016
cc @cswords |
a64bb3a to
d0c8ebaCompareTravis seems to be having unrelated issues. |
bors
commented
May 28, 2016
☔ The latest upstream changes (presumably #33706) made this pull request unmergeable. Please resolve the merge conflicts. |
d0c8eba to
14a8f0aComparedylanmckay
commented
Jun 1, 2016
Am working on fixing this up. |
b7a0f2c to
58d1ae6Comparedylanmckay
commented
Jun 5, 2016
@nrc: Have rewritten the PR so that renovators must push all items which they want to preserve. This is ready for review. |
nrc
commented
Jun 7, 2016
Why must users push the items themselves? That seems a bit counter-intuitive. At the least it needs to be documented somewhere. Given that the renovator behaviour is a strict super-set of decorator and modifier, it would be cool to see their code refactored to just use the renovator code. Would that be possible? |
dylanmckay
commented
Jun 8, 2016
@nrc: @sfackler suggested this behaviour in this comment. I agree with it, and it gives the most flexibility to extensions. Happy to document it more.
It's tricky to merge the three, as there is special handling for the new things that modifiers create. I can merge the |
This adds a new SyntaxExtension type - Renovator. A renovator is a syntax extension which can modify *and* decorate the items it is attached to - the union of `MultiModifier` and `MultiDecorator`. This allows things such as syntax extensions which modify existing methods for types, and implement traits all in one.
58d1ae6 to
dbd5017Comparebors
commented
Jun 8, 2016
☔ The latest upstream changes (presumably #34010) made this pull request unmergeable. Please resolve the merge conflicts. |
nrc
commented
Jun 8, 2016
Ok, that sounds good, more docs would be good though.
What about the new things renovators create? Is this not the same handling? |
dylanmckay
commented
Jun 9, 2016
Modifiers have this special handling expand all the new stuff from the modifier. Decorators and renovators don't need it. |
nrc
commented
Jun 10, 2016
Why don't renovators need it, I'd have thought a renovator which doesn't create new items should behave exactly like a modifier? |
dylanmckay
commented
Jun 10, 2016
No idea, it's just what the current code does. On Sat, Jun 11, 2016 at 2:51 AM, Nick Cameron notifications@github.com
|
nrc
commented
Jun 23, 2016
This PR is superseded by #34253 which achieves a similar goal without adding a new class of macro. Sorry this PR didn't get to land and thanks for submitting it. |
This adds a new
SyntaxExtensiontype -Renovator.A renovator is a syntax extension which can modify and decorate the items it is attached to - the union of
MultiModifierandMultiDecorator.This allows things such as syntax extensions which modify existing methods for types, and implement traits all in one.
This shouldn't break any existing code, and it only touches unstable compiler internals.