Stream: cargo-component

Topic: ✔ Issue with latest cargo component


view this post on Zulip Taylor Thomas (Sep 28 2023 at 18:43):

I have a very simple component I'm writing and I am getting an odd compilation error that I don't think has anything to do with my code. Any insights before I dig further:

cargo component build
   Compiling messaging-wit-test v0.1.0 (/Users/taylor/Documents/code/wasifill-example/actor)
error[E0432]: unresolved import `super`
 --> src/lib.rs:3:1
  |
3 | cargo_component_bindings::generate!();
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `Component` in the root
  |
  = note: this error originates in the macro `cargo_component_bindings::generate` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this enum instead
  |
3 | std::path::Component as _GuestImpl;
  | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0432`.
error: could not compile `messaging-wit-test` (lib) due to previous error

view this post on Zulip Peter Huene (Sep 28 2023 at 18:45):

what's the name of your implementation type?

view this post on Zulip Peter Huene (Sep 28 2023 at 18:46):

by default, it expects Component, if you're using a different name, you need to specify it via the implementor: Name argument to the generate! macro

view this post on Zulip Taylor Thomas (Sep 28 2023 at 18:46):

Oh...that is an interesting gotcha

view this post on Zulip Taylor Thomas (Sep 28 2023 at 18:46):

Yep, that solved it

view this post on Zulip Taylor Thomas (Sep 28 2023 at 18:47):

Thanks for the pointer

view this post on Zulip Notification Bot (Sep 29 2023 at 19:34):

Taylor Thomas has marked this topic as resolved.


Last updated: Nov 25 2024 at 19:03 UTC