Skip to content

Mismatched Rust types at X509 bindings with BoringSSL on Windows 10 #2119

Closed
@HMaker

Description

@HMaker

I am getting the following compiler error when trying to link rust-openssl against BoringSSL (commit f78fe19fc98e0e6f760e05c6b9d48725004700d0, same from CI) on Windows 10:

D:\Users\heraldo\projects\rust-openssl>cargo build -r --package openssl
warning: expando.c
   Compiling openssl v0.10.61 (D:\Users\heraldo\projects\rust-openssl\openssl)
error[E0308]: mismatched types
   --> openssl\src\x509\mod.rs:764:62
    |
764 |                     if ffi::ERR_GET_LIB(err) as X509LenTy == ffi::ERR_LIB_PEM
    |                        ----------------------------------    ^^^^^^^^^^^^^^^^ expected `u32`, found `i32`
    |                        |
    |                        expected because this is `u32`
    |
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
    |
764 |                     if ffi::ERR_GET_LIB(err) as X509LenTy == ffi::ERR_LIB_PEM.try_into().unwrap()
    |                                                                              ++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `openssl` (lib) due to previous error

D:\Users\heraldo\projects\rust-openssl>

My Rust version is:

D:\Users\heraldo\projects\rust-openssl>rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03)

D:\Users\heraldo\projects\rust-openssl>cargo --version
cargo 1.73.0 (9c4383fb5 2023-08-26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions