elast0ny / elast0ny/simple_parse
Improve error message for missing #[sp(var_size)] : attempt to compute <...> wich would overflow
- Vorherrschende Sprache
- Rust
- Sterne
- 13
- Forks
- 1
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.