No `unused field` warnings are produced on enums deriving thiserror::Error

オープン
#446 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

@usmanovbf がすでに取り組んでいます。

2026年3月21日 から。

  • #448 @usmanovbf による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
devtools

調査の方向性

リンクされている Rust Playground の例から始め、通常の enum に対する警告と、thiserror::Error を derive する enum に対する警告を比較してください。報告された挙動を thiserror バージョン 1.0.59 で確認し、#[allow(unused)] が警告に影響するかどうかも含めて確認してください。意図された未使用フィールドの警告が、妥当な allow の挙動とともに生成されれば完了です。

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

説明

see this playground example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=ef85fe807b9e27cb5ffbf6e3a11a1b0c

The warnings generated with a regular enum are not created for a thiserror enum, making it quite hard to catch unused fields in errors. Is this expected ?


From what I can see, if it helps for debugging:
thiserror version 1.0.59 did produce these warnings. However there were no way to disable them (adding #[allow(unused)] to the whole enum, or to the variant did not make the warning go away)

Thanks for the work !

主要言語
Rust
スター
5.6k
フォーク
220
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dtolnay/thiserror のほかの issue

dtolnay/thiserror の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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