-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Deprecate ItemModifier
and ItemDecorator
traits
#21265
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
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
@nick29581 Is this ok? Do you have any suggestions? |
r? @nick29581 |
LGTM. It needs a test - I think there is probably already a test for ItemDecorator somewhere, you could change that to use MultiItemDecorator, or you could create a new test for the Multi- version. |
What kind of test should it be? run-pass? I was unable to find a test for |
probably run-pass-fulldeps. It doesn't look like there is a test for ItemDecorator, you should copy the one for Modifier/MultiModifier. Start with |
ItemModifier
and ItemDecorator
traitsItemModifier
and ItemDecorator
traits
@nick29581 I have added a test |
The test looks great, a few comments on the other commit though |
@nick29581 I have addressed your comments. Thanks for reviewing! I wasn't sure what to do to with |
if attr::cfg_matches(&cx.parse_sess.span_diagnostic, cx.cfg.as_slice(), &**cfg) { | ||
out.attrs.push(cx.attribute(attr.span, attr.clone())); | ||
let attr = cx.attribute(attr.span, attr.clone()); | ||
fold_annotatable!(ann, item => item.attrs.push(attr)) |
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.
@nick29581 Is this implementation of the fold_annotatable
macro OK?
@bors r+ e7f010ef76ebc3fc0fc8261147236c7cbf9a1048 |
⌛ Testing commit e7f010e with merge 31c6018... |
💔 Test failed - auto-mac-32-opt |
Looks like the pretty printer didn't handle attributes on typedefs.
was printed as
I have just fixed it. r? @nick29581 |
@aochagavia r+, but needs a rebase |
After rebasing I am getting the following error (in different places):
I tried adding
Have you seen this before? What's going on? |
@aochagavia probably something to do with http://discuss.rust-lang.org/t/psa-important-info-about-rustcs-new-feature-staging/82 (I haven't read it all myself nor have I seen these errors, so I can't be more specific) |
[breaking-change]
[breaking-change]
It has been replaced by SyntaxExtension::MultiDecorator [breaking-change]
Replaced by SyntaxExtension::MultiModifier [breaking-change]
@nick29581 Thanks for the tip! It should be all right now. |
⌛ Testing commit 143f2db with merge ec03896... |
💔 Test failed - auto-mac-32-opt |
@nick29581 I am unable to find the source of the failure. The output of |
@aochagavia A good start would be to reduce the test case to just a single expansion (it currently tests all the possible expansions, which will generate a lot of expanded code). You should then be able to tell whether there is one particular expansion which is broken or whether all of them have the same bug. If you post the output of |
Needs rebase. |
@Manishearth, @nick29581 I'm not going to finish this PR, since I would need to spend too much time to figure out how to fix it. |
(I might take this over) |
@Manishearth let me know if you decide either way, if you don't, I'll try and take it over the line |
Already started. |
Okay, can repro the failure |
@nick29581 I won't have time to work on this for the next few days, feel free to take over :) |
@Manishearth I'm in no rush. If you think you'll come back to it, it's probably better to keep it. I have a lot on too... |
Not sure if I will :P |
Finished in #25024 |
Awesome! |
Breaking changes:
ItemModifier
trait (useMultiItemModifier
instead)ItemDecorator
trait (useMultiItemDecorator
instead)SyntaxExtension::Decorator
andSyntaxExtension::Modifier
(use theMultiDecorator
andMultiModifier
variants instead)[breaking-change]
Fixes #21155 and #21154