about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2023-12-16 01:49:01 +0000
committerGary Guo <gary@garyguo.net>2024-02-24 14:53:04 +0000
commitf08e2d4137bdf0e443f4061c8b1289f0a92513be (patch)
tree9cfb040963d9a39c5d8d206473b5ab70b89c968f
parent8f359beca4e58bc3ae795a666301a8f47023044c (diff)
downloadrust-f08e2d4137bdf0e443f4061c8b1289f0a92513be.tar.gz
rust-f08e2d4137bdf0e443f4061c8b1289f0a92513be.zip
Forbid use of `extern "C-unwind"` inside standard library
Those libraries are build with `-C panic=unwind` and is expected to
be linkable to `-C panic=abort` library. To ensure unsoundness
compiler needs to prevent a `C-unwind` call to exist, as doing so may leak
foreign exceptions into `-C panic=abort`.
-rw-r--r--library/alloc/src/lib.rs1
-rw-r--r--library/core/src/lib.rs1
-rw-r--r--library/proc_macro/src/lib.rs1
3 files changed, 3 insertions, 0 deletions
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index b84273848ee..45e93feb6c5 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -92,6 +92,7 @@
 #![warn(multiple_supertrait_upcastable)]
 #![allow(internal_features)]
 #![allow(rustdoc::redundant_explicit_links)]
+#![deny(ffi_unwind_calls)]
 //
 // Library features:
 // tidy-alphabetical-start
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 456d88122af..49cead680e3 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -106,6 +106,7 @@
 #![allow(incomplete_features)]
 #![warn(multiple_supertrait_upcastable)]
 #![allow(internal_features)]
+#![deny(ffi_unwind_calls)]
 // Do not check link redundancy on bootstraping phase
 #![allow(rustdoc::redundant_explicit_links)]
 //
diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs
index d05458a6944..610966625b5 100644
--- a/library/proc_macro/src/lib.rs
+++ b/library/proc_macro/src/lib.rs
@@ -36,6 +36,7 @@
 #![feature(strict_provenance)]
 #![recursion_limit = "256"]
 #![allow(internal_features)]
+#![deny(ffi_unwind_calls)]
 
 #[unstable(feature = "proc_macro_internals", issue = "27812")]
 #[doc(hidden)]