cargo-component
cargo-component copied to clipboard
Compile error when installing cargo component
Recently, I got an error when I was installing cargo component
in GitHub actions. The error is:
error[E0061]: this method takes 1 argument but 0 arguments were supplied
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-component-core-0.11.0/src/registry.rs:882:38
|
882 | .load_package(client.get_warg_registry(), e.key())
| ^^^^^^^^^^^^^^^^^-- an argument of type `&str` is missing
|
note: method defined here
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warg-client-0.4.3/src/lib.rs:118:18
|
118 | pub async fn get_warg_registry(
| ^^^^^^^^^^^^^^^^^
help: provide the argument
|
882 | .load_package(client.get_warg_registry(/* &str */), e.key())
| ~~~~~~~~~~~~
error[E0308]: mismatched types
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-component-core-0.11.0/src/registry.rs:882:31
|
882 | .load_package(client.get_warg_registry(), e.key())
| ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<&RegistryDomain>`, found future
| |
| arguments to this method are incorrect
|
note: method defined here
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warg-client-0.4.3/src/storage.rs:111:14
|
111 | async fn load_package(
| ^^^^^^^^^^^^
error[E0599]: no method named `upsert` found for struct `Arc<warg_client::Client<FileSystemRegistryStorage, FileSystemContentStorage, FileSystemNamespaceMapStorage>>` in the current scope
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-component-core-0.11.0/src/registry.rs:594:32
|
594 | (index, client.upsert(upserts.iter()).await)
| ^^^^^^ method not found in `Arc<Client<FileSystemRegistryStorage, FileSystemContentStorage, FileSystemNamespaceMapStorage>>`
Some errors have detailed explanations: E0061, E0308, E0599.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `cargo-component-core` (lib) due to 3 previous errors
This happens for version 0.10.1
(see here) as well as 0.11.0
(see here). I get the same error when I install on my Windows 10 computer with --force
.
I think the install command was working fine a week or two ago, so my first guess would be that a dependency crate released a new minor version with breaking changes (not following semver), and cargo install is now fetching that new version and the build fails because of the breaking change.
EDIT:
You can install cargo component
with the lock file using
cargo install cargo-component --locked
Yep, in warg-client
0.4.1 it's:
pub fn get_warg_registry(&self) -> &Option<RegistryDomain>
But in warg-client
0.4.2 (and 0.4.3) it's:
pub async fn get_warg_registry(
&self,
namespace: &str
) -> Result<Option<RegistryDomain>, ClientError>
I'll create an issue on the warg-client
repo as well, but I think it can be "hotfixed" (for cargo component) by locking the dependency version to 0.4.1
.
warg-protocol
also has a breaking change between 0.4.1
and 0.4.2
:
// 0.4.1
pub fn namespace_state(
&self,
namespace: &str
) -> Result<Option<&NamespaceState>, &str>
// 0.4.2
pub fn namespace_state(&self, namespace: &str) -> Option<&NamespaceState>
I believe the find yesterday was that the install command should use --locked
and a PR was submitted and accepted yesterday too.
You may want to try cargo install cargo-component --locked
if memory serves.
We are trying to find someone with permission to yank the warg
releases. The releases should have increased the minor version since there changes to the exported functions.
Also, https://github.com/bytecodealliance/cargo-component/pull/288 would fix.
Released 0.4.4
as a re-release of 0.4.1
that reverts the breaking changes. Also, we are in the progress of yanking 0.4.2
and 0.4.3
on crates.
Also, #288 would fix.
yea, I think it would be better to just switch to the 0.5.0
version of the warg crates and be done with it.
Merged #288 and resolved this issue.