Partial stabilisation of c_unwind

This commit is contained in:
Gary Guo 2022-12-23 01:01:30 +00:00
parent f2299490c1
commit 723aee2e56
6 changed files with 11 additions and 43 deletions

View File

@ -311,7 +311,7 @@ declare_features! (
(active, async_closure, "1.37.0", Some(62290), None),
/// Allows async functions to be declared, implemented, and used in traits.
(incomplete, async_fn_in_trait, "1.66.0", Some(91611), None),
/// Allows `extern "C-unwind" fn` to enable unwinding across ABI boundaries.
/// Treat `extern "C"` function as nounwind.
(active, c_unwind, "1.52.0", Some(74990), None),
/// Allows using C-variadics.
(active, c_variadic, "1.34.0", Some(44930), None),

View File

@ -4014,7 +4014,6 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #![feature(c_unwind)]
/// #![warn(ffi_unwind_calls)]
///
/// extern "C-unwind" {
@ -4037,8 +4036,7 @@ declare_lint! {
/// that desire this ability it is therefore necessary to avoid such calls.
pub FFI_UNWIND_CALLS,
Allow,
"call to foreign functions or function pointers with FFI-unwind ABI",
@feature_gate = sym::c_unwind;
"call to foreign functions or function pointers with FFI-unwind ABI"
}
declare_lint! {

View File

@ -149,7 +149,9 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
match name {
// Stable
"Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
| "system" | "efiapi" => Ok(()),
| "system" | "efiapi" | "C-unwind" | "cdecl-unwind" | "stdcall-unwind"
| "fastcall-unwind" | "aapcs-unwind" | "win64-unwind" | "sysv64-unwind"
| "system-unwind" => Ok(()),
"rust-intrinsic" => Err(AbiDisabled::Unstable {
feature: sym::intrinsics,
explain: "intrinsics are subject to change",
@ -202,46 +204,14 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
feature: sym::abi_c_cmse_nonsecure_call,
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
}),
"C-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "C-unwind ABI is experimental and subject to change",
}),
"stdcall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "stdcall-unwind ABI is experimental and subject to change",
}),
"system-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "system-unwind ABI is experimental and subject to change",
}),
"thiscall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
feature: sym::abi_thiscall,
explain: "thiscall-unwind ABI is experimental and subject to change",
}),
"cdecl-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "cdecl-unwind ABI is experimental and subject to change",
}),
"fastcall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "fastcall-unwind ABI is experimental and subject to change",
}),
"vectorcall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
feature: sym::abi_vectorcall,
explain: "vectorcall-unwind ABI is experimental and subject to change",
}),
"aapcs-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "aapcs-unwind ABI is experimental and subject to change",
}),
"win64-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "win64-unwind ABI is experimental and subject to change",
}),
"sysv64-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "sysv64-unwind ABI is experimental and subject to change",
}),
"wasm" => Err(AbiDisabled::Unstable {
feature: sym::wasm_abi,
explain: "wasm ABI is experimental and subject to change",

View File

@ -47,7 +47,7 @@ static EXCEPTION_TYPE_INFO: TypeInfo = TypeInfo {
name: b"rust_panic\0".as_ptr(),
};
// NOTE(nbdd0121): The `canary` field will be part of stable ABI after `c_unwind` stabilization.
// NOTE(nbdd0121): The `canary` field is part of stable ABI.
#[repr(C)]
struct Exception {
// See `gcc.rs` on why this is present. We already have a static here so just use it.

View File

@ -48,8 +48,8 @@ use unwind as uw;
static CANARY: u8 = 0;
// NOTE(nbdd0121)
// Once `c_unwind` feature is stabilized, there will be ABI stability requirement
// on this struct. The first two field must be `_Unwind_Exception` and `canary`,
// There is an ABI stability requirement on this struct.
// The first two field must be `_Unwind_Exception` and `canary`,
// as it may be accessed by a different version of the std with a different compiler.
#[repr(C)]
struct Exception {

View File

@ -52,7 +52,7 @@ use core::mem::{self, ManuallyDrop};
use core::ptr;
use libc::{c_int, c_uint, c_void};
// NOTE(nbdd0121): The `canary` field will be part of stable ABI after `c_unwind` stabilization.
// NOTE(nbdd0121): The `canary` field is part of stable ABI.
#[repr(C)]
struct Exception {
// See `gcc.rs` on why this is present. We already have a static here so just use it.