From 93b642d9743edea728ef08b2d6fd17229caaad43 Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Fri, 6 Feb 2015 13:56:38 -0800 Subject: 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] --- src/libsyntax/feature_gate.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libsyntax') 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") { -- cgit 1.4.1-3-g733a5