Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo build fails with "error[E0308]: mismatched types" Error #27

Closed
vwugd97 opened this issue Oct 24, 2020 · 3 comments
Closed

Cargo build fails with "error[E0308]: mismatched types" Error #27

vwugd97 opened this issue Oct 24, 2020 · 3 comments

Comments

@vwugd97
Copy link

vwugd97 commented Oct 24, 2020

Issue description

I'm trying to build nat with my Debian 10 installation. It fails with a "error[E0308]: mismatched types" error.

Steps to reproduce the issue

  1. git clone https://github.com/willdoescode/nat.git
  2. cd ./nat
  3. cargo build --release

What's the expected result?

  • The build should work.

What's the actual result?

  • The build does not work and fails with the following error Message:
Compiling nat v1.0.9 (/home/[USERNAME]/Workspace/git/nat)
     Running `rustc --crate-name nat --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=adba114910da65c6 -C extra-filename=-adba114910da65c6 --out-dir /home/[USERNAME]/Workspace/git/nat/target/release/deps -L dependency=/home/[USERNAME]/Workspace/git/nat/target/release/deps --extern ansi_term=/home/[USERNAME]/Workspace/git/nat/target/release/deps/libansi_term-eadfc56f31755089.rlib --extern chrono=/home/[USERNAME]/Workspace/git/nat/target/release/deps/libchrono-e6ab3cac18a449c9.rlib --extern libc=/home/[USERNAME]/Workspace/git/nat/target/release/deps/liblibc-bec547172235da48.rlib --extern pretty_bytes=/home/[USERNAME]/Workspace/git/nat/target/release/deps/libpretty_bytes-9706fdfae34e91af.rlib --extern structopt=/home/[USERNAME]/Workspace/git/nat/target/release/deps/libstructopt-95351602fc045da0.rlib --extern termion=/home/[USERNAME]/Workspace/git/nat/target/release/deps/libtermion-ba47c272930f5c21.rlib --extern users=/home/[USERNAME]/Workspace/git/nat/target/release/deps/libusers-640153e22e8cf3ab.rlib`
error[E0308]: mismatched types
   --> src/main.rs:207:27
    |
207 |     let user = triplet(mode, S_IRUSR, S_IWUSR, S_IXUSR);
    |                              ^^^^^^^ expected `u16`, found `u32`
    |
help: you can convert an `u32` to `u16` and panic if the converted value wouldn't fit
    |
207 |     let user = triplet(mode, S_IRUSR.try_into().unwrap(), S_IWUSR, S_IXUSR);
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here's the complete build log:

cargo build --verbose --release > out.txt 2>&1

out.txt

Additional details

Some System Info that may or may not help:

$ cargo --version
cargo 1.42.1

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

$ uname -a
Linux [HOSTNAME] 5.8.0-0.bpo.2-amd64 #1 SMP Debian 5.8.10-1~bpo10+1 (2020-09-26) x86_64 GNU/Linux
@vwugd97
Copy link
Author

vwugd97 commented Oct 24, 2020

Seems like there is already a pull request addressing this issue: #28

@spikecodes
Copy link
Contributor

I am getting this error too. +1 for that PR.

@willdoescode
Copy link
Owner

#28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants