flate2-rs icon indicating copy to clipboard operation
flate2-rs copied to clipboard

Compilation error with flate2-ffi

Open rob-p opened this issue 10 months ago • 9 comments
trafficstars

Hi,

I’m using flate2 in a project (several actually) and I recently started getting this error when compiling:

error[E0308]: mismatched types
  --> /home/rob/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.35/src/ffi/c.rs:65:25
   |
65 |                 zalloc: Some(allocator::zalloc),
   |                         ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found `Option<extern "C" fn(..., ..., ...) -> ... {zalloc}>`
   |
   = note: expected fn pointer `unsafe extern "C" fn(*mut c_void, u32, u32) -> *mut c_void`
                    found enum `Option<extern "C" fn(*mut c_void, u32, u32) -> *mut c_void {zalloc}>`

error[E0308]: mismatched types
  --> /home/rob/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.35/src/ffi/c.rs:67:24
   |
67 |                 zfree: Some(allocator::zfree),
   |                        ^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found `Option<extern "C" fn(..., ...) {zfree}>`
   |
   = note: expected fn pointer `unsafe extern "C" fn(*mut c_void, *mut c_void)`
                    found enum `Option<extern "C" fn(*mut c_void, *mut c_void) {zfree}>`

It looks like a change to the FFI that somehow isn’t being properly reflected during compilation. Any idea what may be going on?

rob-p avatar Jan 10 '25 14:01 rob-p