unstale

cargo / thiserror

thiserror

What changed in thiserror 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

4 breaking4 new APIs and options1 behavior and defaults1 tooling1 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

thiserror 211 changes

Breaking changes 4

  • Fields shadowed by an explicit named format argument no longer contribute inferred trait bounds.

    2.0.0release notes

  • Tuple structs and variants cannot combine numerical field access with extra positional format arguments because the references are ambiguous.

    2.0.0release notes

  • Raw identifiers for keyword-named fields are no longer accepted in format strings; use the unraw name instead.

    2.0.0release notes

  • Code invoking thiserror's derive must have a direct dependency on the thiserror crate, regardless of the error data structure.

    2.0.0release notes

New APIs and options 4

  • The #[error(fmt = path::to::myfmt)] attribute lets enum variants define formatting logic out of line.

    2.0.0release notes

  • Using r#source as a field name opts out of treating the field as an error's Error::source().

    2.0.0release notes

  • The default std Cargo feature can be disabled to use thiserror without its standard library dependency.

    2.0.0release notes

  • An individually transparent variant can override an enum-level format message.

    2.0.0release notes

Behavior and default changes 1

  • Infinite recursion in a generated Display implementation now produces an unconditional_recursion warning.

    2.0.0release notes

Tooling 1

  • Suppresses the redundant_field_names clippy lint in generated code, avoiding lint reports for that code.

    2.0.20release notes

Fixes and other changes 1

  • Fixes parsing of generic unit variants in display expressions.

    2.0.21release notes