Skip to content

Component bindgen generates invalid Rust for one-element tuples #1939

Open

Description

@ludfjig

host_bindgen! output doesn't compile for a WIT world that uses tuple<T> with one element:

package a:b;
world w { export f: func(x: tuple<u16>) -> tuple<u16>; }

emit_value emits (u16), which Rust reads as u16, not a tuple. The decoder builds the value the same way at hl.rs#L263, and the encoder then fails on .0.

A one-element tuple needs a trailing comma: (u16,).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions