Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the C-unwind ABI when mocking variadic functions #587

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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