elast0ny / elast0ny/simple_parse

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

オープン
#3 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement question
主要言語
Rust
スター
13
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず simple_parse のサイズチェックの経路と static_assertions crate の使用箇所を追跡し、次に Rust issue #51999 を確認して、そこで言及されている診断上の制限を調べます。完了条件は、分かりにくい overflow 出力を、struct または enum のフィールドを特定し、可能な場合は #[sp(var_size)] を推奨するエラーに置き換えることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
compilers
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。