Stream: cargo-component

Topic: ✔ WIT compilation issue: left behind trailing whitespace


view this post on Zulip Sehz (Mar 04 2024 at 19:04):

I am getting this compilation issue with latest release of cargo component:

error[internal]: left behind trailing whitespace
     --> <stdin>:21896:21896:1
      |
21896 |
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |

warning: rustfmt has failed to format. See previous 292 errors.

thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wit-bindgen-rust-0.20.0/src/lib.rs:1107:13:
assertion failed: status.success()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Peter Huene (Mar 04 2024 at 19:31):

Hi @Sehz. Sorry about that! The latest version of cargo-component tries to format the generated bindings automatically, which is hitting some issues on vary complicated bindings.

We've filed https://github.com/bytecodealliance/wit-bindgen/issues/880 to improve this.

In the meantime, you can disable the automatic formatting by setting package.metadata.component.bindings.format to false.

In order to more structurally work around code formatting issues like those described in #878, we should consider switching from cargo fmt to Dtolnay's prettyplease crate. This crate was designed s...

view this post on Zulip Peter Huene (Mar 04 2024 at 19:32):

I'll amend the release notes with the above information updated!

view this post on Zulip Sehz (Mar 04 2024 at 19:48):

Ok. that fixed the issue. But now getting different error: ```Error: failed to load cargo metadata

Caused by:
cargo metadata exited with an error: error: failed to parse manifest at Cargo.toml

Caused by:
  feature `wasm-component` includes `dep:wit-bindgen`, but `wit-bindgen` is not listed as a dependency```

I am following example here: https://github.com/bytecodealliance/cargo-component/blob/main/example/Cargo.toml. If I add wit-bindgen as dependency like previous release , it works

view this post on Zulip Peter Huene (Mar 04 2024 at 19:50):

Sounds like a feature local to your Cargo.toml (i.e. wasm-component) needs to be updated to use wit-bindgen-rt instead of wit-bindgen

view this post on Zulip Sehz (Mar 04 2024 at 19:52):

I am running latest version of was-component: cargo component --version cargo-component-component 0.9.0 (dc7cb41 2024-03-01 wasi:ab5a448)

view this post on Zulip Sehz (Mar 04 2024 at 19:54):

never mind. There was feature dep to cargo component. sorry

view this post on Zulip Notification Bot (Mar 05 2024 at 22:34):

Sehz has marked this topic as resolved.


Last updated: Nov 25 2024 at 19:03 UTC