Skip to content

derive fails for structs with const generics #60

Description

@MyK00L

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions