CodeSandwich / Mocktopus

Mocking framework for Rust
MIT License
233 stars 20 forks source link

Can't mock universal types #67

Open gregdhill opened 3 years ago

gregdhill commented 3 years ago

Take the following example:

#[mockable]
fn call_with_closure(
    num: u32,
    math_op: impl FnOnce(u32) -> u32,
) -> u32 {
    math_op(num)
}

This fails with the following compilation error:

error[E0641]: cannot cast to a pointer of an unknown kind
  --> src/main.rs:21:10
   |
21 |   ) -> u32 {
   |  __________^
22 | |     math_op(num)
23 | | }
   | |_^ needs more type information