NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io, #13 most downloaded on crates.io
Implementation detail of the `thiserror` crate
Latest stable
2.0.21
Last release 2 months ago
23 Sep 2026
Release timing varies
gaps range from 8 days to 6 months
Most releases are documented
notes for 53 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
91 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
Fix parsing of generic unit variants in display expressions
Suppress redundant_field_names clippy lint in generated code
Update to syn 3
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Make compatible with project-level needless_lifetimes = "forbid" ( #443 , thanks @LucaCappelletti94 )
needless_lifetimes = "forbid" (#443, thanks @LucaCappelletti94)Use differently named __private module per patch release
Add to "no-std" crates.io category
Prevent Error::provide API becoming unavailable from a future new compiler lint
Error::provide API becoming unavailable from a future new compiler lint (#427)Allow build-script cleanup failure with NFSv3 output directory to be non-fatal
Documentation improvements
Prevent elidable_lifetime_names pedantic clippy lint in generated impl
Add feature gate to tests that use std (#409, #410, thanks @Maytha8)
Support errors containing a generic type parameter's associated type in a field
Work around missing_inline_in_public_items clippy restriction being triggered in macro-generated code
missing_inline_in_public_items clippy restriction being triggered in macro-generated code (#404)Improve support for macro-generated derive(Error) call sites
derive(Error) call sites (#399)Work around conflict with #\[deny(clippy::allow_attributes)\] (#397, thanks @zertosh)
Suppress deprecation warning on generated From impls
Prevent deprecation warning on generated impl for deprecated type
Eliminate needless_lifetimes clippy lint in generated From impls (#391, thanks @matt-phylum)
From impls (#391, thanks @matt-phylum)Support the same Path field being repeated in both Debug and Display representation in error message
Fix hang on invalid input inside #\[error(...)\] attribute
Support errors that contain a dynamically sized final field
Referencing keyword-named fields by a raw identifier like {r#type} inside a format string is no longer accepted; simply use the unraw name like {type}
Referencing keyword-named fields by a raw identifier like {r#type} inside a format string is no longer accepted; simply use the unraw name like {type} (#347)
This aligns thiserror with the standard library's formatting macros, which gained support for implicit argument capture later than the release of this feature in thiserror 1.x.
#[derive(Error, Debug)]
#[error("... {type} ...")] // Before: {r#type}
pub struct Error {
pub r#type: Type,
}
Trait bounds are no longer inferred on fields whose value is shadowed by an explicit named argument in a format message (#345)
// Before: impl<T: Octal> Display for Error<T>
// After: impl<T> Display for Error<T>
#[derive(Error, Debug)]
#[error("{thing:o}", thing = "...")]
pub struct Error<T> {
thing: T,
}
Tuple structs and tuple variants can no longer use numerical {0} {1} access at the same time as supplying extra positional arguments for a format message, as this makes it ambiguous whether the number refers to a tuple field vs a different positional arg (#354)
#[derive(Error, Debug)]
#[error("ambiguous: {0} {}", $N)]
// ^^^ Not allowed, use #[error("... {0} {n}", n = $N)]
pub struct TupleError(i32);
Code containing invocations of thiserror's derive(Error) must now have a direct dependency on the thiserror crate regardless of the error data structure's contents (#368, #369, #370, #372)
Support disabling thiserror's standard library dependency by disabling the default "std" Cargo feature: thiserror = { version = "2", default-features = false } (#373)
Support using r#source as field name to opt out of a field named "source" being treated as an error's Error::source() (#350)
#[derive(Error, Debug)]
#[error("{source} ==> {destination}")]
pub struct Error {
r#source: char,
destination: char,
}
let error = Error { source: 'S', destination: 'D' };
Infinite recursion in a generated Display impl now produces an unconditional_recursion warning (#359)
#[derive(Error, Debug)]
#[error("??? {self}")]
pub struct Error;
A new attribute #[error(fmt = path::to::myfmt)] can be used to write formatting logic for an enum variant out-of-line (#367)
#[derive(Error, Debug)]
pub enum Error {
#[error(fmt = demo_fmt)]
Demo { code: u16, message: Option<String> },
}
fn demo_fmt(code: &u16, message: &Option<String>, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "{code}")?;
if let Some(msg) = message {
write!(formatter, " - {msg}")?;
}
Ok(())
}
Enums with an enum-level format message are now able to have individual variants that are transparent to supersede the enum-level message (#366)
#[derive(Error, Debug)]
#[error("my error {0}")]
pub enum Error {
Json(#[from] serde_json::Error),
Yaml(#[from] serde_yaml::Error),
#[error(transparent)]
Other(#[from] anyhow::Error),
}
- Backport 2.0.2 fixes
Handle incomplete expressions more robustly in format arguments, such as while code is being typed (#341, #344)
Improve expression syntax support inside format arguments (#335, #337, #339, #340)
Improve compile error on malformed format attribute
Ensure OUT_DIR is left with deterministic contents after build script execution
Exclude derived impls from coverage instrumentation (#322, thanks @oxalica)
Nothing published for this version
Support referring to nested tuple struct fields inside #[error("…", …)] attribute
#[error("…", …)] attribute (#309)Use core::fmt and core::panic to facilitate error_in_core support (#299, thanks @jordens)
core::fmt and core::panic to facilitate error_in_core support (#299, thanks @jordens)Resolve unexpected_cfgs warning
Unblock testing of rustc debug-fmt-detail option
debug-fmt-detail option (#297)Make backtrace support available when using -Dwarnings
Generate more efficient Display impl for error message which do not contain any interpolated value (#286, thanks @nyurik)
Display impl for error message which do not contain any interpolated value (#286, thanks @nyurik)Update proc-macro2 to fix caching issue when using a rustc-wrapper such as sccache
Work around improperly cached build script result by sccache – second attempt
Work around improperly cached build script result by sccache – first attempt
Reduce spurious rebuilds under RustRover IDE when using a nightly toolchain
Fix interaction with RUSTC_BOOTSTRAP
Improve diagnostics when an invalid attribute previously caused thiserror to generate no Error impl
Error impl (#266)Improve diagnostic when a #\[source\], #\[from\], or #\[transparant\] attribute refers to a type that has no std::Error impl (#258, thanks @de-vri-es)
Access libcore types through ::core in generated code (#255, thanks @mina86)
::core in generated code (#255, thanks @mina86)Improve implementation of displaying Path values in a generated Display impl (#251, thanks @mina86)
- Work around rust-analyzer bug
Add bootstrap workaround to allow rustc to depend on thiserror (#248, thanks @RalfJung)
Update backtrace support to nightly's new Error::provide API
Nothing published for this version
Nothing published for this version
Fix compile error in derived Display impl if there was a nonstandard write! macro in scope
write! macro in scope (#239)Nothing published for this version
- Update syn dependency to 2.x
Nothing published for this version
Nothing published for this version
Nothing published for this version
Documentation improvements (#195, thanks @matklad)
More work on integrating std::Provider for backtrace support
provide methods in scope" error when the caller has both std::error::Error and std::any::Provide traits in scope (#185)Tweak "generic member access" based Backtrace implementation
Expose backtraces via the new "generic member access" API on the Error trait
Add keywords to crates.io metadata
One column per quarter.