Skip to content

Commit 327aa1e

Browse files
committed
Add explicit-extern-abis feature section to the unstable book
1 parent fa1e30a commit 327aa1e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# `explicit_extern_abis`
2+
3+
The tracking issue for this feature is: #134986
4+
5+
------
6+
7+
Disallow `extern` without an explicit ABI. We should write `extern "C"`
8+
(or another ABI) instead of just `extern`.
9+
10+
By making the ABI explicit, it becomes much clearer that "C" is just one of the
11+
possible choices, rather than the "standard" way for external functions.
12+
Removing the default makes it easier to add a new ABI on equal footing as "C".
13+
14+
```rust,editionfuture,compile_fail
15+
#![feature(explicit_extern_abis)]
16+
17+
extern fn function1() {} // ERROR extern declarations without an explicit ABI
18+
// are disallowed
19+
20+
extern "C" fn function2() {} // compile
21+
22+
extern "aapcs" fn function3() {} // compile
23+
```

0 commit comments

Comments
 (0)