elast0ny / elast0ny/simple_parse

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

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
enhancement question
Dominant language
Rust
Stars
13
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/rust-lang/rust/issues/51999

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.