Skip to content

Improve error message for missing #[sp(var_size)] : attempt to compute <...> wich would overflow #3

@elast0ny

Description

@elast0ny

Currently, simple_parse ensures that it does not mistake static/dynamic sizes that it does not know about through the static_assertions crate. Unfortunately when a const assert fails, you get an ugly error message that is confusing at best :

attempt to compute `0_usize - 1_usize`, which would overflow

This error can be fixed by annotating your dynamic fields with #[sp(var_size)]

It would be nice to have an error that says :

  1. Where the annotation is needed (which field of which struct/enum)
  2. What needs to be added (the sp attribute above)

This might not be currently possible because of rust-lang/rust#51999

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions