about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2022-12-23 01:01:30 +0000
committerGary Guo <gary@garyguo.net>2023-04-29 13:01:44 +0100
commit723aee2e56f8136349fdc0de44fdaf351f00c47e (patch)
tree402e856caf490371530cf34ef94988aa864a1c8e
parentf2299490c11b0c53ece5f6a13dd092fc9c99d264 (diff)
downloadrust-723aee2e56f8136349fdc0de44fdaf351f00c47e.tar.gz
rust-723aee2e56f8136349fdc0de44fdaf351f00c47e.zip
Partial stabilisation of `c_unwind`
-rw-r--r--compiler/rustc_feature/src/active.rs2
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs4
-rw-r--r--compiler/rustc_target/src/spec/abi.rs40
-rw-r--r--library/panic_unwind/src/emcc.rs2
-rw-r--r--library/panic_unwind/src/gcc.rs4
-rw-r--r--library/panic_unwind/src/seh.rs2
6 files changed, 11 insertions, 43 deletions
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs
index 052d312d9a0..f046022b842 100644
--- a/compiler/rustc_feature/src/active.rs
+++ b/compiler/rustc_feature/src/active.rs
@@ -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),
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index a3d7bd3ef59..6fe15e21d94 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -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! {
diff --git a/compiler/rustc_target/src/spec/abi.rs b/compiler/rustc_target/src/spec/abi.rs
index 5582d909f6b..a907130d15c 100644
--- a/compiler/rustc_target/src/spec/abi.rs
+++ b/compiler/rustc_target/src/spec/abi.rs
@@ -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",
diff --git a/library/panic_unwind/src/emcc.rs b/library/panic_unwind/src/emcc.rs
index c6d42308596..af18e19337c 100644
--- a/library/panic_unwind/src/emcc.rs
+++ b/library/panic_unwind/src/emcc.rs
@@ -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.
diff --git a/library/panic_unwind/src/gcc.rs b/library/panic_unwind/src/gcc.rs
index 0b7a873a691..08858dd92be 100644
--- a/library/panic_unwind/src/gcc.rs
+++ b/library/panic_unwind/src/gcc.rs
@@ -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 {
diff --git a/library/panic_unwind/src/seh.rs b/library/panic_unwind/src/seh.rs
index 651115a8248..99db00e5490 100644
--- a/library/panic_unwind/src/seh.rs
+++ b/library/panic_unwind/src/seh.rs
@@ -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.