Skip to content

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

Closed
wants to merge 10 commits into from
Closed

Deprecate ItemModifier and ItemDecorator traits #21265

wants to merge 10 commits into from

Conversation

aochagavia
Copy link
Contributor

Breaking changes:

  • Deprecate ItemModifier trait (use MultiItemModifier instead)
  • Deprecate ItemDecorator trait (use MultiItemDecorator instead)
  • Deprecate SyntaxExtension::Decorator and SyntaxExtension::Modifier (use the MultiDecorator and MultiModifier variants instead)

[breaking-change]

Fixes #21155 and #21154

@rust-highfive
Copy link
Contributor

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@aochagavia
Copy link
Contributor Author

@nick29581 Is this ok? Do you have any suggestions?

@brson
Copy link
Contributor

brson commented Jan 16, 2015

r? @nick29581

@rust-highfive rust-highfive assigned nrc and unassigned brson Jan 16, 2015
@nrc
Copy link
Member

nrc commented Jan 19, 2015

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.

@aochagavia
Copy link
Contributor Author

What kind of test should it be? run-pass?

I was unable to find a test for ItemDecorator. Could you point me to it?

@nrc
Copy link
Member

nrc commented Jan 20, 2015

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 auxiliary/macro_crate_test.rs and see where the macros get used (not sure off the top of my head).

@aochagavia aochagavia changed the title WIP: Deprecate ItemModifier and ItemDecorator traits Deprecate ItemModifier and ItemDecorator traits Jan 21, 2015
@aochagavia
Copy link
Contributor Author

@nick29581 I have added a test

@nrc
Copy link
Member

nrc commented Jan 21, 2015

The test looks great, a few comments on the other commit though

@aochagavia
Copy link
Contributor Author

@nick29581 I have addressed your comments. Thanks for reviewing!

I wasn't sure what to do to with cfg_attr. Right now it can be applied on any annotatable. Is that OK?

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))
Copy link
Contributor Author

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?

@nrc
Copy link
Member

nrc commented Jan 23, 2015

@bors r+ e7f010ef76ebc3fc0fc8261147236c7cbf9a1048

@bors
Copy link
Collaborator

bors commented Jan 23, 2015

⌛ Testing commit e7f010e with merge 31c6018...

@bors
Copy link
Collaborator

bors commented Jan 23, 2015

💔 Test failed - auto-mac-32-opt

@aochagavia
Copy link
Contributor Author

Looks like the pretty printer didn't handle attributes on typedefs.

impl Trait for Type {
    #[something]
    type AssocType = AnotherType;
}

was printed as

impl Trait for Type {type
    AssocType
    =
    AnotherType;
}

I have just fixed it. r? @nick29581

@nrc
Copy link
Member

nrc commented Jan 27, 2015

@aochagavia r+, but needs a rebase

@aochagavia
Copy link
Contributor Author

After rebasing I am getting the following error (in different places):

C:\Users\...\Desktop\rust\src\libsyntax\ext\base.rs:33:3: 33:47 error: incorrect stability attribute type
C:\Users\...\Desktop\rust\src\libsyntax\ext\base.rs:33 #[deprecated="Replaced by MultiItemDecorator"]

I tried adding #[unstable] but it doesn't fix it:

C:\Users\...\Desktop\rust\src\libsyntax\ext\base.rs:32:3: 32:11 error: incorrect stability attribute type
C:\Users\...\Desktop\rust\src\libsyntax\ext\base.rs:32 #[unstable]
                                                         ^~~~~~~~
C:\Users\...\Desktop\rust\src\libsyntax\ext\base.rs:33:3: 33:47 error: incorrect stability attribute type
C:\Users\...\Desktop\rust\src\libsyntax\ext\base.rs:33 #[deprecated="Replaced by MultiItemDecorator"]

Have you seen this before? What's going on?

@nrc
Copy link
Member

nrc commented Jan 28, 2015

@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)

@aochagavia
Copy link
Contributor Author

@nick29581 Thanks for the tip! It should be all right now.

@nrc
Copy link
Member

nrc commented Feb 2, 2015

@bors r+ 143f2db

@bors
Copy link
Collaborator

bors commented Feb 2, 2015

⌛ Testing commit 143f2db with merge ec03896...

@bors
Copy link
Collaborator

bors commented Feb 2, 2015

💔 Test failed - auto-mac-32-opt

@aochagavia
Copy link
Contributor Author

@nick29581 I am unable to find the source of the failure. The output of --pretty expanded is really weird and I just can't make sense of it. Maybe this issue is too much for me.

@nrc
Copy link
Member

nrc commented Feb 2, 2015

@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 --pretty expanded here (for the broken expansion if only one or any one of them if all of them) then I can try to help you make sense of it.

@Manishearth
Copy link
Member

Needs rebase.

@aochagavia
Copy link
Contributor Author

@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.

@aochagavia aochagavia closed this Feb 22, 2015
@Manishearth
Copy link
Member

(I might take this over)

@nrc
Copy link
Member

nrc commented Feb 22, 2015

@Manishearth let me know if you decide either way, if you don't, I'll try and take it over the line

@Manishearth
Copy link
Member

@Manishearth
Copy link
Member

Okay, can repro the failure

@Manishearth
Copy link
Member

@nick29581 I won't have time to work on this for the next few days, feel free to take over :)

@nrc
Copy link
Member

nrc commented Feb 24, 2015

@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...

@Manishearth
Copy link
Member

Not sure if I will :P

@nrc
Copy link
Member

nrc commented May 1, 2015

Finished in #25024

@aochagavia
Copy link
Contributor Author

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate, then remove the ItemModifier and ItemDecorator syntax extension traits
6 participants