diff options
| author | Keegan McAllister <kmcallister@mozilla.com> | 2015-02-06 13:56:38 -0800 |
|---|---|---|
| committer | Keegan McAllister <kmcallister@mozilla.com> | 2015-02-09 13:27:27 -0800 |
| commit | 93b642d9743edea728ef08b2d6fd17229caaad43 (patch) | |
| tree | b88ec4e6fac283b95735e7c34dac6760e53a2874 /src/libsyntax | |
| parent | 0ba9e1fa52627404a1e5b90f745f96a872a0c564 (diff) | |
| download | rust-93b642d9743edea728ef08b2d6fd17229caaad43.tar.gz rust-93b642d9743edea728ef08b2d6fd17229caaad43.zip | |
Use a crate attribute to load plugins
#[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 #21043.
Fixes #20769.
[breaking-change]
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c8ab46ff8fd..72bbe1adfaa 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -284,11 +284,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { } match i.node { ast::ItemExternCrate(_) => { - if attr::contains_name(&i.attrs[], "plugin") { - self.gate_feature("plugin", i.span, - "compiler plugins are experimental \ - and possibly buggy"); - } else if attr::contains_name(&i.attrs[], "macro_reexport") { + if attr::contains_name(&i.attrs[], "macro_reexport") { self.gate_feature("macro_reexport", i.span, "macros reexports are experimental \ and possibly buggy"); @@ -462,6 +458,10 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { if attr.check_name("staged_api") { self.gate_feature("staged_api", attr.span, "staged_api is for use by rustc only"); + } else if attr.check_name("plugin") { + self.gate_feature("plugin", attr.span, + "compiler plugins are experimental \ + and possibly buggy"); } if attr::contains_name(slice::ref_slice(attr), "lang") { |
