dtolnay / dtolnay/thiserror

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

Open
#446 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
5.5k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

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 !

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Rust playground example and compare its warnings for a regular enum with those for an enum deriving thiserror::Error. Check the reported behavior against thiserror version 1.0.59, including whether #[allow(unused)] affects the warning; done means the intended unused-field warnings are produced with sensible allow behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.