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

Example fails to compile #25

Open
kylebarron opened this issue Apr 30, 2022 · 2 comments
Open

Example fails to compile #25

kylebarron opened this issue Apr 30, 2022 · 2 comments

Comments

@kylebarron
Copy link

> wasm-pack build
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling async-executor-demo v0.1.0 (/Users/kyle/github/rust/async-executor/example)
error[E0308]: mismatched types
  --> example/src/lib.rs:71:24
   |
71 |     executor::run(Some(task1));
   |                        ^^^^^ expected struct `Task`, found struct `TaskHandle`
   |
   = note: expected struct `Task`
              found struct `TaskHandle<()>`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `async-executor-demo` due to previous error
Error: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"
> cargo --version
cargo 1.60.0 (d1fd9fe2c 2022-03-01)
> rustc --version
rustc 1.60.0 (7737e0b5c 2022-04-04)
@rusxg
Copy link

rusxg commented Aug 18, 2022

Still having the same issue with cargo & rustc version 1.63.0, but with a little more detailed message:

error[E0308]: mismatched types
   --> src/lib.rs:71:24
    |
71  |     executor::run(Some(task1));
    |                   ---- ^^^^^ expected struct `Task`, found struct `TaskHandle`
    |                   |
    |                   arguments to this enum variant are incorrect
    |
    = note: expected struct `Task`
               found struct `TaskHandle<()>`

@rusxg
Copy link

rusxg commented Aug 18, 2022

Not sure if it's the right thing to do, but the example compiles and runs successfully if I add .task() call to convert Task into TaskHandle like this:

    executor::run(Some(task1.task()));

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

2 participants