]> git.lizzy.rs Git - rust.git/commitdiff
add feature gate "abi_vectorcall" for the vectorcall calling convention
authorSteffen <steffen.butzer@outlook.com>
Mon, 11 Jan 2016 22:45:33 +0000 (23:45 +0100)
committerSteffen <steffen.butzer@outlook.com>
Mon, 11 Jan 2016 22:45:33 +0000 (23:45 +0100)
src/doc/book/ffi.md
src/doc/reference.md
src/libsyntax/feature_gate.rs
src/test/compile-fail/feature-gate-abi-vectorcall.rs [new file with mode: 0644]

index e4a67112f18d1152fd518d109d4b646714cb4d06..c00e6c0a07012010a77595686d089139bb63dedd 100644 (file)
@@ -479,6 +479,7 @@ are:
 * `cdecl`
 * `fastcall`
 * `vectorcall`
+This is currently hidden behind the `abi_vectorcall` gate and is subject to change.
 * `Rust`
 * `rust-intrinsic`
 * `system`
index e7cc1436824e42dcd500d7bfff4685ca065e06ee..1daf42d293dc8c26b9de62060bf4de4fdff45ab9 100644 (file)
@@ -2390,6 +2390,9 @@ The currently implemented features of the reference compiler are:
 
 * - `type_ascription` - Allows type ascription expressions `expr: Type`.
 
+* - `abi_vectorcall` - Allows the usage of the vectorcall calling convention
+                             (e.g. `extern "vectorcall" func fn_();`)
+
 If a feature is promoted to a language feature, then all existing programs will
 start to receive compilation warnings about `#![feature]` directives which enabled
 the new feature (because the directive is no longer necessary). However, if a
index 4ea0fd76fea4a6c38868651b0a34eb188f4aa4ae..c168ea9ad75da2a00c7bfe8470e7a6cb9d36a3d8 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)
 
@@ -862,6 +865,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
                 };
@@ -1033,11 +1041,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);
diff --git a/src/test/compile-fail/feature-gate-abi-vectorcall.rs b/src/test/compile-fail/feature-gate-abi-vectorcall.rs
new file mode 100644 (file)
index 0000000..79f3c8d
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern "vectorcall" {   //~ ERROR vectorcall is experimental and subject to change
+    fn bar();
+}
+
+extern "vectorcall" fn baz() {  //~ ERROR vectorcall is experimental and subject to change
+}
+
+fn main() {
+}