Skip to content

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

@anoopelias

Description

@anoopelias

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::<(), ()>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions