Skip to content

Rust generate! not deduping interface type with same name as interface #650

@guybedford

Description

@guybedford

I was just updating wasi-virt to the lateset WIT definition for terminal:

interface terminal-input {
    /// The input side of a terminal.
    ///
    /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
    type terminal-input = u32

    // In the future, this may include functions for disabling echoing,
    // disabling input buffering so that keyboard events are sent through
    // immediately, querying supported features, and so on.

    /// Dispose of the specified terminal-input after which it may no longer
    /// be used.
    drop-terminal-input: func(this: terminal-input)
}

When I use the generate! macro, I get the following type generated:

use crate::exports::wasi::cli::terminal_input::TerminalInput;

where the above is a u32 type and not a trait that can be implemented as expected.

It seems like the interface name and type alias name having the same name is not being deduped properly, when it should probably be a separate crate::exports::wasi::cli::terminal_input::TerminalInput::Terminalnput type I think?

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