From 393ff7e201fa496e979f49558b3731e8da5fb29e Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 23 Jun 2024 19:18:38 -0600 Subject: [PATCH] Use the C-unwind ABI when mocking variadic functions Now that https://github.com/rust-lang/rust/issues/126836 is fixed. --- mockall/tests/automock_foreign_c_variadic.rs | 2 +- mockall_derive/src/mock_item.rs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/mockall/tests/automock_foreign_c_variadic.rs b/mockall/tests/automock_foreign_c_variadic.rs index 5b6e4c26..023bd2dd 100644 --- a/mockall/tests/automock_foreign_c_variadic.rs +++ b/mockall/tests/automock_foreign_c_variadic.rs @@ -29,7 +29,7 @@ fn mocked_c_variadic() { #[test] #[cfg(feature = "nightly")] #[cfg_attr(miri, ignore)] -#[ignore = "https://github.com/rust-lang/rust/issues/126836"] +#[should_panic(expected = "No matching expectation found")] fn panics() { let _m = FOO_MTX.lock(); unsafe{ mock_ffi::foo(1,2,3) }; diff --git a/mockall_derive/src/mock_item.rs b/mockall_derive/src/mock_item.rs index daf8ac5a..f31f7a5f 100644 --- a/mockall_derive/src/mock_item.rs +++ b/mockall_derive/src/mock_item.rs @@ -98,13 +98,9 @@ impl From for MockItemModule { // // BUT, use C-unwind instead of C, so we can panic // from the mock function (rust-lang/rust #74990) - // - // BUT, don't use C-unwind for variadic functions, - // because it doesn't work yet (rust-lang/rust - // #126836) let needs_c_unwind = if let Some(n) = &ifm.abi.name { - n.value() == "C" && f.sig.variadic.is_none() + n.value() == "C" } else { false };