summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2017-07-07 16:09:46 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2017-07-10 12:27:59 +0200
commitc512dea1ed4d97792c831eb2d8ec4725e32ac14d (patch)
tree5fecffc4b0f012481f36dfc7164825b829225cb5 /src/libsyntax
parent33e353ea51e0b266435143cd88458b59d9051d2a (diff)
downloadrust-c512dea1ed4d97792c831eb2d8ec4725e32ac14d.tar.gz
rust-c512dea1ed4d97792c831eb2d8ec4725e32ac14d.zip
Fix feature gate for `#[link_args(..)]` attribute so that it will fire
regardless of context of attribute.

Extend the gating test to include the attribute in "weird" places.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index cb625b1ac06..9448d8a20a3 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -552,7 +552,12 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
     ("ignore", Normal, Ungated),
     ("no_implicit_prelude", Normal, Ungated),
     ("reexport_test_harness_main", Normal, Ungated),
-    ("link_args", Normal, Ungated),
+    ("link_args", Normal, Gated(Stability::Unstable,
+                                "link_args",
+                                "the `link_args` attribute is experimental and not \
+                                 portable across platforms, it is recommended to \
+                                 use `#[link(name = \"foo\")] instead",
+                                cfg_fn!(link_args))),
     ("macro_escape", Normal, Ungated),
 
     // RFC #1445.
@@ -1185,12 +1190,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
             }
 
             ast::ItemKind::ForeignMod(ref foreign_module) => {
-                if attr::contains_name(&i.attrs[..], "link_args") {
-                    gate_feature_post!(&self, link_args, i.span,
-                                      "the `link_args` attribute is not portable \
-                                       across platforms, it is recommended to \
-                                       use `#[link(name = \"foo\")]` instead")
-                }
                 self.check_abi(foreign_module.abi, i.span);
             }