elast0ny / elast0ny/simple_parse

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

Aperta
#3 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement question
Lingua principale
Rust
Stelle
13
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.