Skip to content

"mismatched types" error while building #53

@kaazoo

Description

@kaazoo

I get this error while building with Rust 1.73:

$ cargo build --release
    Updating crates.io index
  Downloaded dirs-sys v0.3.5
  Downloaded serde_derive v1.0.124
  Downloaded directories v2.0.2
  Downloaded unicode-xid v0.2.1
  Downloaded quote v1.0.9
  Downloaded strsim v0.8.0
  Downloaded vec_map v0.8.2
  Downloaded ansi_term v0.11.0
  Downloaded text_io v0.1.8
  Downloaded atty v0.2.14
  Downloaded cfg-if v0.1.10
  Downloaded textwrap v0.11.0
  Downloaded unicode-width v0.1.8
  Downloaded toml v0.5.8
  Downloaded confy v0.4.0
  Downloaded bitflags v1.2.1
  Downloaded serde v1.0.124
  Downloaded proc-macro2 v1.0.24
  Downloaded clap v2.33.3
  Downloaded syn v1.0.64
  Downloaded libc v0.2.90
  Downloaded 21 crates (1.4 MB) in 0.40s
   Compiling libc v0.2.90
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling serde v1.0.124
   Compiling bitflags v1.2.1
   Compiling syn v1.0.64
   Compiling unicode-width v0.1.8
   Compiling serde_derive v1.0.124
   Compiling cfg-if v0.1.10
   Compiling strsim v0.8.0
   Compiling vec_map v0.8.2
   Compiling krunvm v0.2.3 ($HOME/krunvm)
   Compiling textwrap v0.11.0
   Compiling ansi_term v0.11.0
   Compiling text_io v0.1.8
   Compiling quote v1.0.9
   Compiling dirs-sys v0.3.5
   Compiling atty v0.2.14
   Compiling clap v2.33.3
   Compiling directories v2.0.2
   Compiling toml v0.5.8
   Compiling confy v0.4.0
error[E0308]: mismatched types
    --> src/start.rs:96:17
     |
96   |         ps.push(port.as_ptr());
     |            ---- ^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
     |            |
     |            arguments to this method are incorrect
     |
     = note: expected raw pointer `*const i8`
                found raw pointer `*const u8`
note: method defined here
    --> $HOME/snap/rustup/common/rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:1825:12
     |
1825 |     pub fn push(&mut self, value: T) {
     |            ^^^^

error[E0308]: mismatched types
  --> src/start.rs:99:48
   |
99 |     let ret = bindings::krun_set_port_map(ctx, ps.as_ptr());
   |               ---------------------------      ^^^^^^^^^^^ expected `*const *const u8`, found `*const *const i8`
   |               |
   |               arguments to this function are incorrect
   |
   = note: expected raw pointer `*const *const u8`
              found raw pointer `*const *const i8`
note: function defined here
  --> src/bindings.rs:14:12
   |
14 |     pub fn krun_set_port_map(ctx: u32, port_map: *const *const c_char) -> i32;
   |            ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/start.rs:116:32
    |
116 |     let env: [*const i8; 3] = [hostname.as_ptr(), home.as_ptr(), std::ptr::null()];
    |                                ^^^^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
    --> src/start.rs:121:23
     |
121  |             argv.push(a.as_ptr());
     |                  ---- ^^^^^^^^^^ expected `*const i8`, found `*const u8`
     |                  |
     |                  arguments to this method are incorrect
     |
     = note: expected raw pointer `*const i8`
                found raw pointer `*const u8`
note: method defined here
    --> $HOME/snap/rustup/common/rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:1825:12
     |
1825 |     pub fn push(&mut self, value: T) {
     |            ^^^^

error[E0308]: mismatched types
   --> src/start.rs:126:64
    |
126 |         let ret = bindings::krun_set_exec(ctx, c_cmd.as_ptr(), argv.as_ptr(), env.as_ptr());
    |                   -----------------------                      ^^^^^^^^^^^^^ expected `*const *const u8`, found `*const *const i8`
    |                   |
    |                   arguments to this function are incorrect
    |
    = note: expected raw pointer `*const *const u8`
               found raw pointer `*const *const i8`
note: function defined here
   --> src/bindings.rs:16:12
    |
16  |     pub fn krun_set_exec(
    |            ^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `krunvm` (bin "krunvm") due to 5 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions