about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorObei Sideg <obei.sideg@gmail.com>2025-04-08 05:29:19 +0300
committerObei Sideg <obei.sideg@gmail.com>2025-04-15 14:33:19 +0300
commitee53c26b41a74eb0ecf785e8cfac98e5aa980756 (patch)
treeaf9ce3475f7897bb37682d8f3189b4f46bfaafea /src/doc
parentc580c498a1fe144d7c5b2dfc7faab1a229aa288b (diff)
downloadrust-ee53c26b41a74eb0ecf785e8cfac98e5aa980756.tar.gz
rust-ee53c26b41a74eb0ecf785e8cfac98e5aa980756.zip
Add `explicit_extern_abis` unstable feature
also add `explicit-extern-abis` feature section to
the unstable book.
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/unstable-book/src/language-features/explicit-extern-abis.md23
1 files changed, 23 insertions, 0 deletions
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
+```