We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ae96420 + c9ff02f commit 77e27a0Copy full SHA for 77e27a0
tests/compile-fail/panic/bad_unwind.rs
@@ -0,0 +1,16 @@
1
+// error-pattern: calling a function with ABI C-unwind using caller ABI C
2
+#![feature(c_unwind)]
3
+
4
+//! Unwinding when the caller ABI is "C" (without "-unwind") is UB.
5
+//! Currently we detect the ABI mismatch; we could probably allow such calls in principle one day
6
+//! but then we have to detect the unexpected unwinding.
7
8
+extern "C-unwind" fn unwind() {
9
+ panic!();
10
+}
11
12
+fn main() {
13
+ let unwind: extern "C-unwind" fn() = unwind;
14
+ let unwind: extern "C" fn() = unsafe { std::mem::transmute(unwind) };
15
+ std::panic::catch_unwind(|| unwind()).unwrap_err();
16
0 commit comments