Skip to content

Commit 8cdad62

Browse files
committed
add feature gate "abi_vectorcall" for the vectorcall calling convention
1 parent 9af75d2 commit 8cdad62

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

src/doc/book/ffi.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ are:
479479
* `cdecl`
480480
* `fastcall`
481481
* `vectorcall`
482+
This is currently hidden behind the `abi_vectorcall` gate and is subject to change.
482483
* `Rust`
483484
* `rust-intrinsic`
484485
* `system`

src/doc/reference.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,6 +2390,9 @@ The currently implemented features of the reference compiler are:
23902390

23912391
* - `type_ascription` - Allows type ascription expressions `expr: Type`.
23922392

2393+
* - `abi_vectorcall` - Allows the usage of the vectorcall calling convention
2394+
(e.g. `extern "vectorcall" func fn_();`)
2395+
23932396
If a feature is promoted to a language feature, then all existing programs will
23942397
start to receive compilation warnings about `#![feature]` directives which enabled
23952398
the new feature (because the directive is no longer necessary). However, if a

src/libsyntax/feature_gate.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
239239

240240
// Allows cfg(target_thread_local)
241241
("cfg_target_thread_local", "1.7.0", Some(29594), Active),
242+
243+
// rustc internal
244+
("abi_vectorcall", "1.7.0", None, Active)
242245
];
243246
// (changing above list without updating src/doc/reference.md makes @cmr sad)
244247

@@ -862,6 +865,11 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
862865
Abi::PlatformIntrinsic => {
863866
Some(("platform_intrinsics",
864867
"platform intrinsics are experimental and possibly buggy"))
868+
},
869+
Abi::Vectorcall => {
870+
Some(("abi_vectorcall",
871+
"vectorcall is experimental and subject to change"
872+
))
865873
}
866874
_ => None
867875
};
@@ -1033,11 +1041,17 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
10331041
"intrinsics are subject to change")
10341042
}
10351043
FnKind::ItemFn(_, _, _, _, abi, _) |
1036-
FnKind::Method(_, &ast::MethodSig { abi, .. }, _) if abi == Abi::RustCall => {
1037-
self.gate_feature("unboxed_closures",
1038-
span,
1039-
"rust-call ABI is subject to change")
1040-
}
1044+
FnKind::Method(_, &ast::MethodSig { abi, .. }, _) => match abi {
1045+
Abi::RustCall => {
1046+
self.gate_feature("unboxed_closures", span,
1047+
"rust-call ABI is subject to change");
1048+
},
1049+
Abi::Vectorcall => {
1050+
self.gate_feature("abi_vectorcall", span,
1051+
"vectorcall is experimental and subject to change");
1052+
},
1053+
_ => {}
1054+
},
10411055
_ => {}
10421056
}
10431057
visit::walk_fn(self, fn_kind, fn_decl, block, span);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
extern "vectorcall" { //~ ERROR vectorcall is experimental and subject to change
12+
fn bar();
13+
}
14+
15+
extern "vectorcall" fn baz() { //~ ERROR vectorcall is experimental and subject to change
16+
}
17+
18+
fn main() {
19+
}

0 commit comments

Comments
 (0)