bincode icon indicating copy to clipboard operation
bincode copied to clipboard

#[derive(Encode)] and friends break on structs with default generic arguments

Open bitwiseshiftleft opened this issue 3 years ago • 2 comments

I'm testing against 2.0.0-rc.1.

The derive macros cause syntax errors when given a struct with a default generic argument, such as:

#[derive(Encode)]
struct Foo<Bar=Baz> {}

This produces the following error:

error: Invalid rust syntax, expected ', > or an ident, got Some(Punct { ch: '=', spacing: Alone, span: #0 bytes(104880..104881) })
  --> src/xxx.rs:87:15
   |
87 | struct Foo<Bar=Baz> {}

(I tested this in some project, so there is an unhelpful line number.)

bitwiseshiftleft avatar Apr 06 '22 11:04 bitwiseshiftleft

Same problem I have with negative numbers - error: Invalid rust syntax, expected literal, got Some(Punct { ch: '-', spacing: Alone, span: #0 bytes(20762..20763) })

#[derive(Copy, Clone, PartialEq, Eq, Encode, Decode)]
pub enum TypeOfFile {
    Unknown = -1,
}

qarmin avatar May 01 '22 08:05 qarmin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 14 '22 22:08 stale[bot]