From 00b3c1405e5df26f9c6408e5fd43f52fa12e8e07 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 31 Jul 2024 12:25:46 -0700 Subject: [PATCH 1/4] Work around new dead code warning in test warning: struct `StructTransparentGeneric` is never constructed --> tests/test_generics.rs:161:12 | 161 | pub struct StructTransparentGeneric(E); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default --- tests/test_generics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_generics.rs b/tests/test_generics.rs index ac5d6f3b..d7790e2d 100644 --- a/tests/test_generics.rs +++ b/tests/test_generics.rs @@ -158,4 +158,4 @@ pub struct StructFromGeneric { // #[derive(Error, Debug)] #[error(transparent)] -pub struct StructTransparentGeneric(E); +pub struct StructTransparentGeneric(pub E); From ab5b5e375b26971850b134abc7bbfe8a67da0fe3 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 25 Aug 2024 12:12:25 -0700 Subject: [PATCH 2/4] Upload CI Cargo.lock for reproducing failures --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 313d8929..65a20f51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,11 @@ jobs: run: echo RUSTFLAGS=${RUSTFLAGS}\ --cfg=thiserror_nightly_testing >> $GITHUB_ENV if: matrix.rust == 'nightly' - run: cargo test --all + - uses: actions/upload-artifact@v4 + if: matrix.rust == 'nightly' && always() + with: + name: Cargo.lock + path: Cargo.lock minimal: name: Minimal versions From ae1f47e3e5d6705b6b12997bd036fd97303d71d7 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sun, 22 Sep 2024 11:24:53 -0400 Subject: [PATCH 3/4] Mark #[automatically_derived] for generated impls --- impl/src/expand.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/impl/src/expand.rs b/impl/src/expand.rs index 296b567b..403cd07d 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -36,6 +36,7 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream { #error #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics std::error::Error for #ty #ty_generics #where_clause where // Work around trivial bounds being unstable. @@ -44,6 +45,7 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream { {} #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::fmt::Display for #ty #ty_generics #where_clause { fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { ::core::unreachable!() @@ -178,6 +180,7 @@ fn impl_struct(input: Struct) -> TokenStream { let display_where_clause = display_inferred_bounds.augment_where_clause(input.generics); quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::fmt::Display for #ty #ty_generics #display_where_clause { #[allow(clippy::used_underscore_binding)] fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { @@ -193,6 +196,7 @@ fn impl_struct(input: Struct) -> TokenStream { let body = from_initializer(from_field, backtrace_field); quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause { #[allow(deprecated)] fn from(source: #from) -> Self { @@ -211,6 +215,7 @@ fn impl_struct(input: Struct) -> TokenStream { quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics std::error::Error for #ty #ty_generics #error_where_clause { #source_method #provide_method @@ -427,6 +432,7 @@ fn impl_enum(input: Enum) -> TokenStream { let display_where_clause = display_inferred_bounds.augment_where_clause(input.generics); Some(quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::fmt::Display for #ty #ty_generics #display_where_clause { fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { #use_as_display @@ -449,6 +455,7 @@ fn impl_enum(input: Enum) -> TokenStream { let body = from_initializer(from_field, backtrace_field); Some(quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause { #[allow(deprecated)] fn from(source: #from) -> Self { @@ -467,6 +474,7 @@ fn impl_enum(input: Enum) -> TokenStream { quote! { #[allow(unused_qualifications)] + #[automatically_derived] impl #impl_generics std::error::Error for #ty #ty_generics #error_where_clause { #source_method #provide_method From 84484bc75c20d63ec63299354b463407f3d59f68 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 22 Sep 2024 10:53:10 -0700 Subject: [PATCH 4/4] Release 1.0.64 --- Cargo.toml | 4 ++-- impl/Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 71f10086..1d1f8b05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thiserror" -version = "1.0.63" +version = "1.0.64" authors = ["David Tolnay "] categories = ["rust-patterns"] description = "derive(Error)" @@ -12,7 +12,7 @@ repository = "https://github.com/dtolnay/thiserror" rust-version = "1.56" [dependencies] -thiserror-impl = { version = "=1.0.63", path = "impl" } +thiserror-impl = { version = "=1.0.64", path = "impl" } [dev-dependencies] anyhow = "1.0.73" diff --git a/impl/Cargo.toml b/impl/Cargo.toml index cafcd02a..4195d578 100644 --- a/impl/Cargo.toml +++ b/impl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" authors = ["David Tolnay "] description = "Implementation detail of the `thiserror` crate" edition = "2021" diff --git a/src/lib.rs b/src/lib.rs index 42dd65b6..92d3c5dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -258,7 +258,7 @@ //! //! [`anyhow`]: https://github.com/dtolnay/anyhow -#![doc(html_root_url = "https://docs.rs/thiserror/1.0.63")] +#![doc(html_root_url = "https://docs.rs/thiserror/1.0.64")] #![allow( clippy::module_name_repetitions, clippy::needless_lifetimes,