Skip to content

Commit

Permalink
Merge pull request #587 from asomers/variadic-c-unwind
Browse files Browse the repository at this point in the history
Use the C-unwind ABI when mocking variadic functions
  • Loading branch information
asomers authored Jun 25, 2024
2 parents bcb4a88 + 393ff7e commit f9edf41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mockall/tests/automock_foreign_c_variadic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) };
Expand Down
6 changes: 1 addition & 5 deletions mockall_derive/src/mock_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,9 @@ impl From<MockableModule> 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
};
Expand Down

0 comments on commit f9edf41

Please sign in to comment.