From ee53c26b41a74eb0ecf785e8cfac98e5aa980756 Mon Sep 17 00:00:00 2001 From: Obei Sideg Date: Tue, 8 Apr 2025 05:29:19 +0300 Subject: Add `explicit_extern_abis` unstable feature also add `explicit-extern-abis` feature section to the unstable book. --- .../src/language-features/explicit-extern-abis.md | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/explicit-extern-abis.md (limited to 'src') diff --git a/src/doc/unstable-book/src/language-features/explicit-extern-abis.md b/src/doc/unstable-book/src/language-features/explicit-extern-abis.md new file mode 100644 index 00000000000..ba622466ba7 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/explicit-extern-abis.md @@ -0,0 +1,23 @@ +# `explicit_extern_abis` + +The tracking issue for this feature is: #134986 + +------ + +Disallow `extern` without an explicit ABI. We should write `extern "C"` +(or another ABI) instead of just `extern`. + +By making the ABI explicit, it becomes much clearer that "C" is just one of the +possible choices, rather than the "standard" way for external functions. +Removing the default makes it easier to add a new ABI on equal footing as "C". + +```rust,editionfuture,compile_fail +#![feature(explicit_extern_abis)] + +extern fn function1() {} // ERROR `extern` declarations without an explicit ABI + // are disallowed + +extern "C" fn function2() {} // compiles + +extern "aapcs" fn function3() {} // compiles +``` -- cgit 1.4.1-3-g733a5