binrw icon indicating copy to clipboard operation
binrw copied to clipboard

bw(ignore) does not work

Open winterqt opened this issue 2 years ago • 0 comments

Both of the following examples do work, and fail with the same error (in case there's something unrelated that's invalid about one):

#[binrw]
struct X {
    #[bw(ignore)]
    b: u8,
}
#[binrw]
#[br(map = x)]
struct X {
    #[bw(ignore)]
    b: u8,
}

fn x(a: u8) -> X {
    X { b: 1 }
}
error[E0283]: type annotations needed
  --> src/main.rs:3:1
   |
3  | #[binrw]
   | ^^^^^^^^ consider giving this closure parameter a type
   |
  ::: /Users/winter/.cargo/registry/src/github.com-1ecc6299db9ec823/binrw-0.8.0/src/private.rs:98:11
   |
98 |     Args: Clone,
   |           ----- required by this bound in `write_fn_type_hint`
   |
   = note: cannot satisfy `_: Clone`
   = note: this error originates in the attribute macro `binrw` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider specifying the type arguments in the function call
   |
3  | #[binrw]::<T, WriterFn, Writer, Args>
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

binrw version: 0.8.0

winterqt avatar Oct 26 '21 00:10 winterqt