diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-04-17 00:16:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-17 00:16:20 +0200 |
| commit | bb3e156f62c8a7f2f88ff70d513f35e9c1ddc40f (patch) | |
| tree | a20e5870572e82c1d870be7a858f19d187138636 /src | |
| parent | 78f2104e334068d5a892a170d50193c0025c690e (diff) | |
| parent | d17c04e4a220d6f7bf170eeb0f90498e215555fa (diff) | |
| download | rust-bb3e156f62c8a7f2f88ff70d513f35e9c1ddc40f.tar.gz rust-bb3e156f62c8a7f2f88ff70d513f35e9c1ddc40f.zip | |
Rollup merge of #135340 - obeis:explicit-extern-abis, r=traviscross,nadrieril
Add `explicit_extern_abis` Feature and Enforce Explicit ABIs The unstable `explicit_extern_abis` feature is introduced, requiring explicit ABIs in `extern` blocks. Hard errors will be enforced with this feature enabled in a future edition. RFC rust-lang/rfcs#3722 Update #134986
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/explicit-extern-abis.md | 23 |
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 +``` |
