bytecodealliance / bytecodealliance/cargo-component
Cannot specify world to target for package referenced from a registry
- Dominant language
- Rust
- Stars
- 593
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Description
I have a component that adds two numbers. It uses the adder world defined in `ghcr.io/bytecodealliance/docs/adder:0.1.0`. In my Cargo.toml, I get an error if I specify the world within the package i want to target. This happens to be redundant in this case as only the adder world exists in the package, but I would expect it to still be permitted.
[Example app](https://github.com/kate-goldenring/component-docs/blob/rust-fetch-wit-from-ghcr/component-model/examples/tutorial/adder/Cargo.toml)
`Cargo.toml`:
```toml
[package.metadata.component.target]
# The registry which contains the package
registry = "ghcr.io/bytecodealliance"
# The package name
package = "docs:adder"
# The package version
version = "0.1.0"
# Adding the following incurs an erro
world = "adder"
```
Error during `cargo component build --release`:
```sh
error: failed to create a target world for package `adder` (/Users/kagold/Programs/component-docs/component-model/examples/tutorial/adder/Cargo.toml)
Caused by:
0: failed to select world from target package `docs:adder`
1: no world named `adder` in package
For now, i'll leave the world out but ill file an issue with cargo-component
```
WIT can be fetched
```sh
wkg get --format wit docs:adder@0.1.0 --output adder.wit --registry ghcr.io
```
WIT:
```wit
package docs:adder@0.1.0;
interface add {
add: func(a: u32, b: u32) -> u32;
}
world adder {
export add;
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.