Skip to content

FreeBSD arm64 compile fails due to type mismatch #117

@feld

Description

@feld

Encountered while building the Deltachat-rpc-server:

error[E0308]: mismatched types
  --> /wrkdirs/usr/ports/net/deltachat-rpc-server/work/core-1.159.3/cargo-crates/netdev-0.31.0/src/interface/unix.rs:192:28
   |
192 |             let nlen: i8 = (*sa).sa_data[3];
   |                       --   ^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
   |                       |
   |                       expected due to this
   |
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
   |
192 |             let nlen: i8 = (*sa).sa_data[3].try_into().unwrap();
   |                                            ++++++++++++++++++++

error[E0308]: mismatched types
  --> /wrkdirs/usr/ports/net/deltachat-rpc-server/work/core-1.159.3/cargo-crates/netdev-0.31.0/src/interface/unix.rs:193:28
   |
193 |             let alen: i8 = (*sa).sa_data[4];
   |                       --   ^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
   |                       |
   |                       expected due to this
   |
help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit
   |
193 |             let alen: i8 = (*sa).sa_data[4].try_into().unwrap();
   |                                            ++++++++++++++++++++

The arm64 API defines char as unsigned which I believe is the root cause here: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#10arm-c-and-c-language-mappings

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