speedy icon indicating copy to clipboard operation
speedy copied to clipboard

`derive` fails for structs with const generics

Open MyK00L opened this issue 1 year ago • 0 comments

trying to compile

#[derive(speedy::Readable)]
struct A<const S: usize> {
    a: [u8;S],
}

results in this error

 --> src/main.rs:3:12
  |
3 |     a: [u8;S],
  |            ^ not found in this scope

error[E0107]: missing generics for struct `A`
 --> src/main.rs:2:8
  |
2 | struct A<const S: usize> {
  |        ^ expected 1 generic argument
  |
note: struct defined here, with 1 generic parameter: `S`
 --> src/main.rs:2:8
  |
2 | struct A<const S: usize> {
  |        ^ --------------
help: add missing generic argument
  |
2 | struct A<S><const S: usize> {
  |         +++

Which I thought was very weird and funny before I finally understood it was inside code generated by a macro.

MyK00L avatar Nov 19 '23 10:11 MyK00L