You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0599]: no method named `mock_raw` found for type `unsafe fn() -> i32 {test::count}` in the current scope
--> src\example.rs:10:23
|
| count.mock_raw(|| MockResult::Return(0));
| ^^^^^^^^
|
= note: count is a function, perhaps you wish to call it
= note: the method `mock_raw` exists but the following trait bounds were not satisfied:
`unsafe fn() -> i32 {test::count} : mocktopus::mocking::Mockable<_, _>`
The text was updated successfully, but these errors were encountered:
One solution could be to switch whole API to using fn, but it lacks some first class citizenshipness. For example you can't implement a trait for fn item and you can't cast fn item to fn pointer without manually writing its signature. Also fn pointers are not unique, two functions can have the same address.
Trying to mock an unsafe function results in an error. Is there any particular reason my unsafe function cannot be mocked?
Minimal test:
Output:
The text was updated successfully, but these errors were encountered: