-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Use a crate attribute to load plugins #22026
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) |
Seems reasonable to me. r? @sfackler |
This stops it being possible to load a plugin in a submodule, right? Also, does it work with |
Yeah, which sounds good to me.
No; |
Seems pretty easy to solve the cfg_attr issue by just moving the load call into the beginning of expansion. |
The |
#[plugin] #[no_link] extern crate bleh; becomes a crate attribute #![plugin(bleh)] The feature gate is still required. It's almost never correct to link a plugin into the resulting library / executable, because it will bring all of libsyntax and librustc with it. However if you really want this behavior, you can get it with a separate `extern crate` item in addition to the `plugin` attribute. Fixes rust-lang#21043. Fixes rust-lang#20769. [breaking-change]
Rebased. @sfackler, with the |
@@ -284,11 +284,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { | |||
} | |||
match i.node { | |||
ast::ItemExternCrate(_) => { |
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.
Can you add a message telling people what to do if they still have a #[plugin]
-tagged extern crate?
r=me with the nit. Up to you on if you want to wait and let the cfg_attr change land first or not. |
```rust #[plugin] #[no_link] extern crate bleh; ``` becomes a crate attribute ```rust #![plugin(bleh)] ``` The feature gate is still required. It's almost never correct to link a plugin into the resulting library / executable, because it will bring all of libsyntax and librustc with it. However if you really want this behavior, you can get it with a separate `extern crate` item in addition to the `plugin` attribute. Fixes #21043. Fixes #20769. [breaking-change]
💔 Test failed - auto-win-64-opt |
@bors: retry |
```rust #[plugin] #[no_link] extern crate bleh; ``` becomes a crate attribute ```rust #![plugin(bleh)] ``` The feature gate is still required. It's almost never correct to link a plugin into the resulting library / executable, because it will bring all of libsyntax and librustc with it. However if you really want this behavior, you can get it with a separate `extern crate` item in addition to the `plugin` attribute. Fixes #21043. Fixes #20769. [breaking-change]
becomes a crate attribute
#![plugin(bleh)]
The feature gate is still required.
It's almost never correct to link a plugin into the resulting library / executable, because it will bring all of libsyntax and librustc with it. However if you really want this behavior, you can get it with a separate
extern crate
item in addition to theplugin
attribute.Fixes #21043.
Fixes #20769.
[breaking-change]