Add explicit_extern_abis
unstable feature
also add `explicit-extern-abis` feature section to the unstable book.
This commit is contained in:
parent
c580c498a1
commit
ee53c26b41
3 changed files with 26 additions and 0 deletions
|
@ -477,6 +477,8 @@ declare_features! (
|
|||
(incomplete, ergonomic_clones, "1.87.0", Some(132290)),
|
||||
/// Allows exhaustive pattern matching on types that contain uninhabited types.
|
||||
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
|
||||
/// Disallows `extern` without an explicit ABI.
|
||||
(unstable, explicit_extern_abis, "CURRENT_RUSTC_VERSION", Some(134986)),
|
||||
/// Allows explicit tail calls via `become` expression.
|
||||
(incomplete, explicit_tail_calls, "1.72.0", Some(112788)),
|
||||
/// Allows using `aapcs`, `efiapi`, `sysv64` and `win64` as calling conventions
|
||||
|
|
|
@ -916,6 +916,7 @@ symbols! {
|
|||
expf16,
|
||||
expf32,
|
||||
expf64,
|
||||
explicit_extern_abis,
|
||||
explicit_generic_args_with_impl_trait,
|
||||
explicit_tail_calls,
|
||||
export_name,
|
||||
|
|
|
@ -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
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue