Skip to content

wasmtime::component::bindgen named_imports error if interface name contains a hyphen #14090

Description

@itowlson

When I try to use wasmtime::component::bindgen's new named_imports option on an interface with a hyphen in it, I get an error.

A repro case is here: https://github.com/itowlson/implements-hyphen-test

  • The first commit in the repo defines an interface named myitf and bindgens a host for it, with a named_imports for the myitf interface.

  • The second commit changes the interface name to my-itf with a hyphen (no other changes except propagating the name change). The bindgen now fails with the error:

error: expected one of `;` or `{`, found `-`
 --> src/main.rs:2:5
  |
2 | /     wasmtime::component::bindgen!({
3 | |         path: "./wit",
4 | |         world: "w",
5 | |         named_imports: {
6 | |             "impo:impo/my-itf@1.2.3": String,
7 | |         },
8 | |     });
  | |______^ expected one of `;` or `{`

Tested with Cargo 1.97.1 and Cargo 1.99.0-nightly.

I am not sure if I am doing something wrong but it seems like this could be an issue with named_imports bindgen?

(I tried to see the expansion of the macro so I could share that, but I wasn't able to get it, sorry.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions