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

[BUG] Trait bound not satisfied for usbd-hid-macros crate #39

Open
jake-g00dwin opened this issue Jul 19, 2024 · 5 comments
Open

[BUG] Trait bound not satisfied for usbd-hid-macros crate #39

jake-g00dwin opened this issue Jul 19, 2024 · 5 comments

Comments

@jake-g00dwin
Copy link

Ran into an issues with building and testing the examples for the ch32v203. This is what I'm getting when I try to run cargo build --bin blinky.

error[E0277]: the trait bound `usbd_hid_descriptors::MainItemKind: From<std::string::String>` is not satisfied
   --> /home/ronin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/usbd-hid-macros-0.6.0/src/spec.rs:512:43
    |
512 |             self.set_item(name, item_kind.into(), settings, bits, quirks);
    |                                           ^^^^ the trait `From<std::string::String>` is not implemented for `usbd_hid_descriptors::MainItemKind`, which is required by `std::string::String: Into<_>`
    |
    = help: the trait `From<&str>` is implemented for `usbd_hid_descriptors::MainItemKind`
    = help: for that trait implementation, expected `&str`, found `std::string::String`
    = note: required for `std::string::String` to implement `Into<usbd_hid_descriptors::MainItemKind>`

   Compiling futures-util v0.3.30
For more information about this error, try `rustc --explain E0277`.
error: could not compile `usbd-hid-macros` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

It's coming from the GroupSpec Impl in the USBD HID macros crate.

@jake-g00dwin
Copy link
Author

Okay found the upstream issue: usbd-hid issue 73
and embassy issue 3078

Basically it's an issue with embassy and dependencies user older versions of the crate when the 0.8 version is the only one that really works right now.

Using the nightly-2024-06-12 tool chain seems to still run into the same issue as of right now.

@jake-g00dwin
Copy link
Author

Had some time to mess with it again today, managed to find a workaround. Using the examples for the ch32v203 and the nightly tool-chain from 2024-06-11 I managed to get it to build and compile.

I had to first edit the Cargo.toml file so that it used the other embassy line and also so it didn't include the usb dependency.

//---SNIP---
#embassy-usb = { version = "0.1.0" }
//---SNIP---
[patch.crates-io]
embassy-executor-macros = { git = 'https://github.com/embassy-rs/embassy'}
//---SNIP---

Final thing I noticed is that some examples required me to add a line for a feature dealing with implementing traits for associated types.

#![feature(impl_trait_in_assoc_type)]

After adding that line I can compile and flash the blinky, adc and the uart(serial) programs without any issues.

@andelf
Copy link
Contributor

andelf commented Jul 23, 2024

I'm planing to change embassy-related deps to git version.

@twitchyliquid64
Copy link

Worth noting theres a 0.6 and 0.7 patch release that fixes this if you don't want to update to 0.8 crates from usbd-hid.

@jake-g00dwin
Copy link
Author

@twitchyliquid64 Nice, that sounds like a great temporary solution as well.

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

No branches or pull requests

3 participants