Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add composability for general import #1380

Merged

Conversation

macovedj
Copy link
Contributor

Motivation:

Currently WASI-Virt is unable to operate on components created via cargo-component if their worlds define types, rather than importing them from an interface. For example if a component uses the following in its wit

world foo {
    type name = u32;
}

it must instead be written as

interface types {
    type name = u32;
}

world foo {
    import types;
    export types;
}

otherwise one will encounter this error when using WASI-Virt

Error: Unable to compose virtualized adapter into component.
Make sure virtualizations are enabled and being used.

Caused by:
    component `component.wasm` has a non-instance import named `name`

This is due to WASI-Virt's usage of wasm-compose, which has a limitation that is no longer needed described below.

Currently wasm-compose assumes every import in a dependency should be an instance resolved to an instantiation. Since originally developed, it has become more common for components to import types directly alongside instances to be composed with one another. This change removes the check that any imports in dependencies being resolved are instance imports, enabling components that directly import types be used in a composition.

@peterhuene peterhuene merged commit 8b9ba68 into bytecodealliance:main Jan 19, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants