Skip to content

Build fails: error[E307]: mismatched types #607

Open
@yurivict

Description

@yurivict

Build fails:

error[E307]: mismatched types
  --> src/fs/metadata.rs:85:55
   |
85 |                 let sflag = SFlag::from_bits_truncate(metadata_mode);
   |                             ------------------------- ^^^^^^^^^^^^^ expected `u16`, found `u32`
   |                             |
   |                             arguments to this function are incorrect
   |
note: associated function defined here
  --> /wrkdirs/usr/ports/sysutils/joshuto/work/joshuto-0.9.9/cargo-crates/nix-0.30.1/src/sys/stat.rs:14:1
   |
14 | / libc_bitflags!(
15 | |     /// "File type" flags for `mknod` and related functions.
16 | |     pub struct SFlag: mode_t {
17 | |         S_IFIFO;
...  |
26 | | );
   | |_^
   = note: this error originates in the macro `$crate::__impl_bitflags` which comes from the expansion of the macro `libc_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
   |                 
85 |                 let sflag = SFlag::from_bits_truncate(metadata_mode.try_into().unwrap()); 
   |                                                                    ++++++++++++++++++++
   
error[E0308]: mismatched types
  --> src/fs/metadata.rs:91:53
   |
91 |                 let mode = Mode::from_bits_truncate(metadata_mode);
   |                            ------------------------ ^^^^^^^^^^^^^ expected `u16`, found `u32`
   |                            |
   |                            arguments to this function are incorrect
   | 
note: associated function defined here
  --> /wrkdirs/usr/ports/sysutils/joshuto/work/joshuto-0.9.9/cargo-crates/nix-0.30.1/src/sys/stat.rs:28:1
   | 

nix-rust/nix#2639

Version: 0.9.9
rust-1.86.0
FreeBSD 14.2

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