]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/feature_gate.rs
Only retain external static symbols across LTO
[rust.git] / src / libsyntax / feature_gate.rs
index 3054c307f36d95cfed856979318c8539571d5883..9bf1dd49db572ceb0f00f62f606571f604aeb18e 100644 (file)
 
     // Allows cfg(target_thread_local)
     ("cfg_target_thread_local", "1.7.0", Some(29594), Active),
+
+    // rustc internal
+    ("abi_vectorcall", "1.7.0", None, Active)
 ];
 // (changing above list without updating src/doc/reference.md makes @cmr sad)
 
@@ -812,11 +815,11 @@ fn visit_expr(&mut self, e: &ast::Expr) {
         // But we keep these checks as a pre-expansion check to catch
         // uses in e.g. conditionalized code.
 
-        if let ast::ExprBox(_) = e.node {
+        if let ast::ExprKind::Box(_) = e.node {
             self.context.gate_feature("box_syntax", e.span, EXPLAIN_BOX_SYNTAX);
         }
 
-        if let ast::ExprInPlace(..) = e.node {
+        if let ast::ExprKind::InPlace(..) = e.node {
             self.context.gate_feature("placement_in_syntax", e.span, EXPLAIN_PLACEMENT_IN);
         }
 
@@ -852,7 +855,7 @@ fn visit_name(&mut self, sp: Span, name: ast::Name) {
 
     fn visit_item(&mut self, i: &ast::Item) {
         match i.node {
-            ast::ItemExternCrate(_) => {
+            ast::ItemKind::ExternCrate(_) => {
                 if attr::contains_name(&i.attrs[..], "macro_reexport") {
                     self.gate_feature("macro_reexport", i.span,
                                       "macros reexports are experimental \
@@ -860,7 +863,7 @@ fn visit_item(&mut self, i: &ast::Item) {
                 }
             }
 
-            ast::ItemForeignMod(ref foreign_module) => {
+            ast::ItemKind::ForeignMod(ref foreign_module) => {
                 if attr::contains_name(&i.attrs[..], "link_args") {
                     self.gate_feature("link_args", i.span,
                                       "the `link_args` attribute is not portable \
@@ -872,6 +875,11 @@ fn visit_item(&mut self, i: &ast::Item) {
                     Abi::PlatformIntrinsic => {
                         Some(("platform_intrinsics",
                               "platform intrinsics are experimental and possibly buggy"))
+                    },
+                    Abi::Vectorcall => {
+                        Some(("abi_vectorcall",
+                            "vectorcall is experimental and subject to change"
+                        ))
                     }
                     _ => None
                 };
@@ -880,7 +888,7 @@ fn visit_item(&mut self, i: &ast::Item) {
                 }
             }
 
-            ast::ItemFn(..) => {
+            ast::ItemKind::Fn(..) => {
                 if attr::contains_name(&i.attrs[..], "plugin_registrar") {
                     self.gate_feature("plugin_registrar", i.span,
                                       "compiler plugins are experimental and possibly buggy");
@@ -899,7 +907,7 @@ fn visit_item(&mut self, i: &ast::Item) {
                 }
             }
 
-            ast::ItemStruct(..) => {
+            ast::ItemKind::Struct(..) => {
                 if attr::contains_name(&i.attrs[..], "simd") {
                     self.gate_feature("simd", i.span,
                                       "SIMD types are experimental and possibly buggy");
@@ -920,14 +928,14 @@ fn visit_item(&mut self, i: &ast::Item) {
                 }
             }
 
-            ast::ItemDefaultImpl(..) => {
+            ast::ItemKind::DefaultImpl(..) => {
                 self.gate_feature("optin_builtin_traits",
                                   i.span,
                                   "default trait implementations are experimental \
                                    and possibly buggy");
             }
 
-            ast::ItemImpl(_, polarity, _, _, _, _) => {
+            ast::ItemKind::Impl(_, polarity, _, _, _, _) => {
                 match polarity {
                     ast::ImplPolarity::Negative => {
                         self.gate_feature("optin_builtin_traits",
@@ -980,13 +988,13 @@ fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
 
     fn visit_expr(&mut self, e: &ast::Expr) {
         match e.node {
-            ast::ExprBox(_) => {
+            ast::ExprKind::Box(_) => {
                 self.gate_feature("box_syntax",
                                   e.span,
                                   "box expression syntax is experimental; \
                                    you can call `Box::new` instead.");
             }
-            ast::ExprType(..) => {
+            ast::ExprKind::Type(..) => {
                 self.gate_feature("type_ascription", e.span,
                                   "type ascription is experimental");
             }
@@ -1045,11 +1053,17 @@ fn visit_fn(&mut self,
                                   "intrinsics are subject to change")
             }
             FnKind::ItemFn(_, _, _, _, abi, _) |
-            FnKind::Method(_, &ast::MethodSig { abi, .. }, _) if abi == Abi::RustCall => {
-                self.gate_feature("unboxed_closures",
-                                  span,
-                                  "rust-call ABI is subject to change")
-            }
+            FnKind::Method(_, &ast::MethodSig { abi, .. }, _) => match abi {
+                Abi::RustCall => {
+                    self.gate_feature("unboxed_closures", span,
+                        "rust-call ABI is subject to change");
+                },
+                Abi::Vectorcall => {
+                    self.gate_feature("abi_vectorcall", span,
+                        "vectorcall is experimental and subject to change");
+                },
+                _ => {}
+            },
             _ => {}
         }
         visit::walk_fn(self, fn_kind, fn_decl, block, span);
@@ -1057,17 +1071,17 @@ fn visit_fn(&mut self,
 
     fn visit_trait_item(&mut self, ti: &'v ast::TraitItem) {
         match ti.node {
-            ast::ConstTraitItem(..) => {
+            ast::TraitItemKind::Const(..) => {
                 self.gate_feature("associated_consts",
                                   ti.span,
                                   "associated constants are experimental")
             }
-            ast::MethodTraitItem(ref sig, _) => {
+            ast::TraitItemKind::Method(ref sig, _) => {
                 if sig.constness == ast::Constness::Const {
                     self.gate_feature("const_fn", ti.span, "const fn is unstable");
                 }
             }
-            ast::TypeTraitItem(_, Some(_)) => {
+            ast::TraitItemKind::Type(_, Some(_)) => {
                 self.gate_feature("associated_type_defaults", ti.span,
                                   "associated type defaults are unstable");
             }
@@ -1124,7 +1138,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler,
             Some(list) => {
                 for mi in list {
                     let name = match mi.node {
-                        ast::MetaWord(ref word) => (*word).clone(),
+                        ast::MetaItemKind::Word(ref word) => (*word).clone(),
                         _ => {
                             span_handler.span_err(mi.span,
                                                   "malformed feature, expected just \