Skip to content

Commit

Permalink
Use the C-unwind ABI when mocking variadic functions
Browse files Browse the repository at this point in the history
Now that rust-lang/rust#126836 is fixed.
  • Loading branch information
asomers committed Jun 24, 2024
1 parent bcb4a88 commit 393ff7e
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 393ff7e

Please sign in to comment.