镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Open

Description

@eli-sauvage

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 !

Activity

  1. changed the title [-]No unused field warnings[/-] [+]No `unused field` warnings are produced on enums deriving thiserror::Error[/+] on Feb 17, 2026
  2. ollbx commented on Mar 3, 2026

    @ollbx

    I have the same issue. Especially when refactoring / prototyping, I end up with error variants that I do not actually use and no easy way of finding them. While it probably makes sense to keep around error codes for released libraries in order to not break backwards compatibility, it would be great to have this configurable in some way (and to be fair #[allow(unused)] already exists for this).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions