sharksforarms / deku

Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization
Apache License 2.0
1.14k stars 55 forks source link

Type mismatch when using anyhow #310

Closed dullbananas closed 1 year ago

dullbananas commented 1 year ago

When I import anyhow::{Result, Ok}, a type mismatch with DekuError and anyhow::Error occurs in the derive macros for deku.

sharksforarms commented 1 year ago

Could you provide a failing example?

ImplOfAnImpl commented 1 year ago

I have the same issue.

The code:

struct Result {}

#[derive(deku::DekuRead)]
struct Test {}

fn main() {}

Compiler output:

error[E0107]: this struct takes 0 generic arguments but 2 generic arguments were supplied
 --> src/main.rs:3:10
  |
3 | #[derive(deku::DekuRead)]
  |          ^^^^^^^^^^^^^^- help: remove these generics
  |          |
  |          expected 0 generic arguments
  |
note: struct defined here, with 0 generic parameters
 --> src/main.rs:1:8
  |
1 | struct Result {}
  |        ^^^^^^
  = note: this error originates in the derive macro `deku::DekuRead` (in Nightly builds, run with -Z macro-backtrace for more info)

Perhaps Deku's macros should always use fully qualified paths when referring to standard stuff?