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

Sample code in Readme.md of wasmtime crate is not compiling #6796

Closed
anoopelias opened this issue Aug 3, 2023 · 0 comments · Fixed by #6797
Closed

Sample code in Readme.md of wasmtime crate is not compiling #6796

anoopelias opened this issue Aug 3, 2023 · 0 comments · Fixed by #6797
Labels
bug Incorrect behavior in the current implementation that needs fixing

Comments

@anoopelias
Copy link
Contributor

The sample code in Readme.md of wasmtime crate is not compiling.

Steps to Reproduce

  • Copy the code from this section of the Readme.md under crates/wasmtime/Readme.md
  • Paste it in a main.rs
  • Compile using cargo run

Expected Results

The code gets compiled and results get printed.

Actual Results

Compilation error,

error[E0107]: method takes 2 generic arguments but 3 generic arguments were supplied
   --> src/main.rs:31:26
    |
31  |     let hello = instance.get_typed_func::<(), (), _>(&mut store, "hello")?;
    |                          ^^^^^^^^^^^^^^           - help: remove this generic argument
    |                          |
    |                          expected 2 generic arguments
    |
note: method defined here, with 2 generic parameters: `Params`, `Results`
   --> /Users/xyz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasmtime-11.0.1/src/instance.rs:455:12
    |
455 |     pub fn get_typed_func<Params, Results>(
    |            ^^^^^^^^^^^^^^ ------  -------
    = note: `impl Trait` cannot be explicitly specified as a generic argument

Versions and Environment

Wasmtime version or commit: Current tip of the main 615d697a0ba11df4fccf36fefa29d0fc42c270641

Additional Information

This is a simple issue, should work if we remove the third generic argument and keep it as instance.get_typed_func::<(), ()>.

@anoopelias anoopelias added the bug Incorrect behavior in the current implementation that needs fixing label Aug 3, 2023
anoopelias added a commit to anoopelias/wasmtime that referenced this issue Aug 3, 2023
Sample code provided in Readme of `wasmtime` crate specifies three
generic arguments for `get_typed_func` API, while it needs only two.
This fixes the sample code by removing the last generic argument.
github-merge-queue bot pushed a commit that referenced this issue Aug 3, 2023
Sample code provided in Readme of `wasmtime` crate specifies three
generic arguments for `get_typed_func` API, while it needs only two.
This fixes the sample code by removing the last generic argument.
geekbeast pushed a commit to geekbeast/wasmtime that referenced this issue Aug 6, 2023
… feature/preview2

* 'feature/preview2' of github.com:geekbeast/wasmtime:
  Change preview2 builder methods to use `&mut self` (bytecodealliance#6770)
  Add a bindgen test that exercises using error types from a different interface (bytecodealliance#6802)
  Resolve trappable error types with fully qualified package paths (bytecodealliance#6795)
  Update the dev-dependency for wit-bindgen to 0.9.0 (bytecodealliance#6800)
  Fix incorrect sample code in documentation (bytecodealliance#6796) (bytecodealliance#6797)
  Update preview1 to trap on misaligned pointers (bytecodealliance#6776)
  Fix posix-signals-on-macos on aarch64-apple-darwin (bytecodealliance#6793)
  consistient WASI preview1 rights reporting (bytecodealliance#6784)
  Wasmtime: Introduce `{Module,Component}::resources_required` (bytecodealliance#6789)
eduardomourar pushed a commit to eduardomourar/wasmtime that referenced this issue Aug 18, 2023
…ytecodealliance#6797)

Sample code provided in Readme of `wasmtime` crate specifies three
generic arguments for `get_typed_func` API, while it needs only two.
This fixes the sample code by removing the last generic argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant