elast0ny / elast0ny/simple_parse
Improve error message for missing #[sp(var_size)] : attempt to compute <...> wich would overflow
- Lenguaje dominante
- Rust
- Estrellas
- 13
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Empieza siguiendo la ruta de comprobación de tamaño de simple_parse y su uso del crate static_assertions; después, revisa Rust issue #51999 para conocer las limitaciones de diagnóstico mencionadas. Se considera terminado cuando se reemplace la salida de overflow confusa por un error que identifique el campo de la struct o enum y recomiende #[sp(var_size)] cuando sea viable.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- rust
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100