Sqlx: rust sqlx installation fails due to mismatched types

Created on 12 Oct 2020  Â·  2Comments  Â·  Source: launchbadge/sqlx

Hi all, installing rust sqlx on Ubuntu 18.04

I get the error below

 error[E0308]: mismatched types
     --> sqlx-cli/src/opt.rs:8:20
      |
    8 |     #[clap(short = "D", long)]
      |                    ^^^ expected `char`, found `&str`

    error: aborting due to previous error

    For more information about this error, try `rustc --explain E0308`.
    error: could not compile `sqlx-cli`.

    To learn more, run the command again with --verbose.
    warning: build failed, waiting for other jobs to finish...
    error: failed to compile `sqlx-cli v0.1.0-beta.1 (https://github.com/launchbadge/sqlx#8e4d061d)`, intermediate artifacts can be found at `/tmp/cargo-installfRUbiY`

    Caused by:
      build failed


     francesco@francesco-yoga720  ~/projects/auth-service  master ● ?  rustc --explain E0308                                                                                    INT(-2) ↵  4266  17:20:07 


    Expected type did not match the received type.

    Erroneous code example:

    ``
    let x: i32 = "I am not a number!";
    //     ~~~   ~~~~~~~~~~~~~~~~~~~~
    //      |             |
    //      |    initializing expression;
    //      |    compiler infers type `&str`
    //      |
    //    type `i32` assigned to variable `x`
    ``

    This error occurs when the compiler is unable to infer the concrete type of a
    variable. It can occur in several cases, the most common being a mismatch
    between two types: the type the author explicitly assigned, and the type the
    compiler inferred.
    (END)

     francesco@francesco-yoga720  ~/projects/auth-service  master ● ?  rustc --version                                                                                          INT(-2) ↵  4266  17:20:40 
    rustc 1.47.0 (18bf6b4f0 2020-10-07)
     francesco@francesco-yoga720  ~/projects/auth-service  master ● ?  cargo --version                                                                                                  ✔  4267  17:21:20 
    cargo 1.47.0 (f3c7e066a 2020-08-28)

If needed you can find full logs here

I'm new to rust so let me know if I need to provide more details

any idea how to solve the error and complete the installation?

Thank you

Here's the mirror question on StacckOverflow

Most helpful comment

cargo install -f --git https://github.com/launchbadge/sqlx sqlx-cli completes successfully now,

All 2 comments

Same here, both on stable and nightly.

cargo install -f --git https://github.com/launchbadge/sqlx sqlx-cli completes successfully now,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abonander picture abonander  Â·  3Comments

mehcode picture mehcode  Â·  9Comments

yorodm picture yorodm  Â·  7Comments

DarrienG picture DarrienG  Â·  4Comments

sam701 picture sam701  Â·  6Comments