Skip to content

Build breakage with libc 0.2.154 from git #2342

Open
@asomers

Description

@asomers

Nix builds successfully with the most recently released libc: 0.2.153. But the version currently in git contains some backwards-incompatible changes.

Here is a simplified build output, on FreeBSD amd64:

error[E0308]: mismatched types
   --> src/sys/select.rs:113:65
    |
113 |             range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
    |                                                       --------- ^^^^^^^^^^ expected `usize`, found `i32`
    |                                                       |
    |                                                       arguments to this method are incorrect
    |
help: the return type of this call is `i32` due to the type of the argument passed
   --> src/sys/select.rs:113:23
    |
113 |             range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^
    |                                                                 |
    |                                                                 this argument influences the return type of `unwrap_or`
note: method defined here
   --> /localhome/somers/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/core/src/option.rs:953:12
    |
953 |     pub fn unwrap_or(self, default: T) -> T {
    |            ^^^^^^^^^
help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
    |
113 |             range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE.try_into().unwrap()),
    |                                                                           ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/unistd.rs:826:41
    |
826 |     unsafe { libc::execv(path.as_ptr(), args_p.as_ptr()) };
    |              -----------                ^^^^^^^^^^^^^^^ types differ in mutability
    |              |
    |              arguments to this function are incorrect
    |
    = note: expected raw pointer `*const *mut i8`
               found raw pointer `*const *const i8`
note: function defined here
   --> /usr/home/somers/src/rust/libc/src/unix/mod.rs:843:12
    |
843 |     pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int;
    |            ^^^^^

See
rust-lang/libc#3597
rust-lang/libc#3356
rust-lang/libc#3466

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions