Skip to content

wit: name collision + noff_var_id #1328

@jsturtevant

Description

@jsturtevant

What happened?

When a WIT component imports multiple interfaces that share the same final name from different packages (e.g. wasi:filesystem/types and wasi:http/types), the host_bindgen! macro generates duplicate trait members in the RootImports trait:

// Both wasi:filesystem/types and wasi:http/types produce:
type Types = ...;
fn types(&mut self) -> ...;

This causes: error[E0428]: the name 'Types' is defined multiple times

Additionally, once colliding names are disambiguated (e.g. FilesystemTypes), noff_var_id and emit_resource_ref still generate the old un-disambiguated name (I::Types) for type variable references and resource table entries, causing error[E0220]: associated type 'Types' not found for 'I'.

Steps to Reproduce

Use a WIT world that imports both wasi:filesystem/types and wasi:http/types:

world root {
  import wasi:filesystem/types@0.2.0;
  import wasi:http/types@0.2.0;
  export my:app/executor;
}
WIT_WORLD=world.wasm cargo build

Expected Results

Each interface gets a unique trait member name, e.g.:

  • wasi:filesystem/typesFilesystemTypes / filesystem_types()
  • wasi:http/typesHttpTypes / http_types()

Actual Results

TODO: What actually happened?

Versions and Environment

Hyperlight version or commit: TODO

OS Version

Run the following to find your OS version:

Linux:

cat /etc/os-release && uname -a

Windows (PowerShell):

cmd /c ver

Hypervisor

Run the following to check hypervisor access:

Linux:

ls -la /dev/kvm /dev/mshv 2>&1; getfacl /dev/kvm /dev/mshv 2>&1; id
[ -r /dev/kvm ] && [ -w /dev/kvm ] && echo "KVM: OK" || echo "KVM: FAIL"
[ -r /dev/mshv ] && [ -w /dev/mshv ] && echo "MSHV: OK" || echo "MSHV: FAIL"

Windows (Admin PowerShell):

Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -match 'Hyper-V|HypervisorPlatform|VirtualMachinePlatform'} | Format-Table

Extra Info

Anything else you'd like to add?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions