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

Would a PR to use Macros 1.1 be welcome #50

Closed
sgrif opened this issue Dec 25, 2016 · 4 comments
Closed

Would a PR to use Macros 1.1 be welcome #50

sgrif opened this issue Dec 25, 2016 · 4 comments
Labels
question A question (converts to discussion)

Comments

@sgrif
Copy link
Contributor

sgrif commented Dec 25, 2016

While most of your codegen won't be satisfied by Macros 1.1, your custom derives will be. Using libsyntax for custom derive is currently deprecated (and sounds like it's slated for removal in 1.15). Would you be open to a PR to pull the custom derives out into a separate crate which uses macros 1.1?

@sgrif
Copy link
Contributor Author

sgrif commented Dec 25, 2016

Also sorry for randomly dropping a bunch of issues on you on Christmas.

@SergioBenitez SergioBenitez added the question A question (converts to discussion) label Dec 26, 2016
@SergioBenitez
Copy link
Member

No worries on the issues! I appreciate your diligence. :)

I've given some thought to this, and at present, I'd rather keep derives as they are. My main argument against moving to macros 1.1 is that it adds another crate, and thus another line to src/main.rs. I expanded on this in the following comment: rust-lang/rust#37128 (comment).

That being said, it may be possible to reexport the derives from the core rocket crate, and so you'd only need to add #[macro_use] to extern crate rocket. If the derive code for macros 1.1 is significantly cleaner, for whatever reason, and this reexport can indeed be done, then I might be convinced. Still, I worry that this avenue might be confusing to users. Why should they import a plugin via #[plugin(...)] and do a #[macro_use]? Codegen can be a confusing subject, and I'd like to avoid all means to further confusion.

@sgrif
Copy link
Contributor Author

sgrif commented Dec 26, 2016

It would need to be a separate crate as it's a separate compilation mode.

@sgrif sgrif closed this as completed Dec 26, 2016
@SergioBenitez
Copy link
Member

I'm okay with having another crate as long as users don't need to explicitly import it. What I was referring to was that it might be possible to, in the rocket crate, add something like:

#[macro_reexport] extern crate rocket_derive;

And then users would write:

#[macro_use] extern crate rocket;

Is this what you're referring to when you say it won't work? I haven't explored this myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A question (converts to discussion)
Projects
None yet
Development

No branches or pull requests

2 participants