Skip to content

Compilation error with flate2-ffi #442

Open
@rob-p

Description

@rob-p

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions