From 032b44287c57f35eadf7ee63278ef63a1e55bb4c Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 4 Aug 2023 15:12:25 +0200 Subject: [PATCH 1/4] Update changelog --- serde_with/CHANGELOG.md | 5 +++++ serde_with_macros/CHANGELOG.md | 2 ++ 2 files changed, 7 insertions(+) diff --git a/serde_with/CHANGELOG.md b/serde_with/CHANGELOG.md index b68ac9ee..2bc2b0eb 100644 --- a/serde_with/CHANGELOG.md +++ b/serde_with/CHANGELOG.md @@ -17,6 +17,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * Bump MSRV to 1.64, since that is required for the indexmap v2 dependency. +### Fixed + +* Prevent panics when deserializing `i64::MIN` using `TimestampSeconds` (#632, #633) + Thanks to @hollmmax for reporting and fixing the issue. + ## [3.1.0] - 2023-07-17 ### Added diff --git a/serde_with_macros/CHANGELOG.md b/serde_with_macros/CHANGELOG.md index a55e786c..d43ad6f4 100644 --- a/serde_with_macros/CHANGELOG.md +++ b/serde_with_macros/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +No changes. + ## [3.1.0] - 2023-07-17 No changes. From febdcc5b156846302973f7cc12d1e821b9b3698c Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 4 Aug 2023 15:12:45 +0200 Subject: [PATCH 2/4] Fix some issues in CONTRIBUTING.md --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cc4bc287..1e015a7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,8 +9,8 @@ Check out the [user guide][user guide] to find out more tips and tricks about this crate. -For further help using this crate you can [open a new discussion](https://github.com/jonasbb/serde_with/discussions/new) or ask on [users.rust-lang.org](https://users.rust-lang.org/). -For bugs please open a [new issue](https://github.com/jonasbb/serde_with/issues/new) on GitHub. +For further help using this crate, you can [open a new discussion](https://github.com/jonasbb/serde_with/discussions/new) or ask on [users.rust-lang.org](https://users.rust-lang.org/). +For bugs, please open a [new issue](https://github.com/jonasbb/serde_with/issues/new) on GitHub. ## Reporting Bugs @@ -23,7 +23,7 @@ Make sure to include the three major parts of information: 3. If possible prepare a minimal running example. Security vulnerabilities should be reported privately as [security advisory](https://github.com/jonasbb/serde_with/security). -Check [./SECURITY.md] for details. +Check [SECURITY.md](./SECURITY.md) for details. ## Submitting a PR From 831fdbc64db6521ff1e44a930713cebd81b7a3e2 Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 4 Aug 2023 15:19:14 +0200 Subject: [PATCH 3/4] Tweak cargo release config Change default commit message. --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index a5a82fd2..d8cb669f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ resolver = "2" [workspace.metadata.release] consolidate-commits = true +pre-release-commit-message = "Bump version to v{{version}}" publish = false push = false shared-version = true From 8b2a74a820419f23031f7ab113956e8b15aba2db Mon Sep 17 00:00:00 2001 From: Jonas Bushart Date: Fri, 4 Aug 2023 16:04:34 +0200 Subject: [PATCH 4/4] Bump version to v3.2.0 --- Cargo.lock | 4 ++-- README.md | 14 +++++++------- serde_with/CHANGELOG.md | 2 ++ serde_with/Cargo.toml | 4 ++-- serde_with/src/lib.rs | 26 +++++++++++++------------- serde_with_macros/CHANGELOG.md | 2 ++ serde_with_macros/Cargo.toml | 2 +- serde_with_macros/src/lib.rs | 10 +++++----- 8 files changed, 34 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8c7d591..894d43d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -599,7 +599,7 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.1.0" +version = "3.2.0" dependencies = [ "base64 0.21.0", "chrono", @@ -629,7 +629,7 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.1.0" +version = "3.2.0" dependencies = [ "darling", "expect-test", diff --git a/README.md b/README.md index 5a7ab5fb..f531530f 100644 --- a/README.md +++ b/README.md @@ -183,14 +183,14 @@ Foo::Bytes { } ``` -[`DisplayFromStr`]: https://docs.rs/serde_with/3.1.0/serde_with/struct.DisplayFromStr.html -[`with_prefix!`]: https://docs.rs/serde_with/3.1.0/serde_with/macro.with_prefix.html -[feature flags]: https://docs.rs/serde_with/3.1.0/serde_with/guide/feature_flags/index.html -[skip_serializing_none]: https://docs.rs/serde_with/3.1.0/serde_with/attr.skip_serializing_none.html -[StringWithSeparator]: https://docs.rs/serde_with/3.1.0/serde_with/struct.StringWithSeparator.html -[user guide]: https://docs.rs/serde_with/3.1.0/serde_with/guide/index.html +[`DisplayFromStr`]: https://docs.rs/serde_with/3.2.0/serde_with/struct.DisplayFromStr.html +[`with_prefix!`]: https://docs.rs/serde_with/3.2.0/serde_with/macro.with_prefix.html +[feature flags]: https://docs.rs/serde_with/3.2.0/serde_with/guide/feature_flags/index.html +[skip_serializing_none]: https://docs.rs/serde_with/3.2.0/serde_with/attr.skip_serializing_none.html +[StringWithSeparator]: https://docs.rs/serde_with/3.2.0/serde_with/struct.StringWithSeparator.html +[user guide]: https://docs.rs/serde_with/3.2.0/serde_with/guide/index.html [with-annotation]: https://serde.rs/field-attrs.html#with -[as-annotation]: https://docs.rs/serde_with/3.1.0/serde_with/guide/serde_as/index.html +[as-annotation]: https://docs.rs/serde_with/3.2.0/serde_with/guide/serde_as/index.html ## License diff --git a/serde_with/CHANGELOG.md b/serde_with/CHANGELOG.md index 2bc2b0eb..a48f469f 100644 --- a/serde_with/CHANGELOG.md +++ b/serde_with/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [3.2.0] - 2023-08-04 + ### Added * Add optional support for indexmap v2 (#621) diff --git a/serde_with/Cargo.toml b/serde_with/Cargo.toml index 49e1b99e..1dca1d2d 100644 --- a/serde_with/Cargo.toml +++ b/serde_with/Cargo.toml @@ -6,7 +6,7 @@ authors = [ ] name = "serde_with" rust-version = "1.64" -version = "3.1.0" +version = "3.2.0" categories = ["encoding", "no-std", "no-std::no-alloc"] description = "Custom de/serialization functions for Rust's serde" @@ -72,7 +72,7 @@ indexmap_2 = {package = "indexmap", version = "2.0", optional = true, default-fe # https://github.com/jonasbb/serde_with/blob/eb1965a74a3be073ecd13ec05f02a01bc1c44309/serde_with/src/flatten_maybe.rs#L67 serde = {version = "1.0.157", default-features = false, features = ["derive"] } serde_json = {version = "1.0.45", optional = true, default-features = false} -serde_with_macros = {path = "../serde_with_macros", version = "=3.1.0", optional = true} +serde_with_macros = {path = "../serde_with_macros", version = "=3.2.0", optional = true} time_0_3 = {package = "time", version = "~0.3.11", optional = true, default-features = false} [dev-dependencies] diff --git a/serde_with/src/lib.rs b/serde_with/src/lib.rs index e350ff96..8a51068e 100644 --- a/serde_with/src/lib.rs +++ b/serde_with/src/lib.rs @@ -26,7 +26,7 @@ #![doc(test(attr(warn(rust_2018_idioms))))] // Not needed for 2018 edition and conflicts with `rust_2018_idioms` #![doc(test(no_crate_inject))] -#![doc(html_root_url = "https://docs.rs/serde_with/3.1.0/")] +#![doc(html_root_url = "https://docs.rs/serde_with/3.2.0/")] #![cfg_attr(docsrs, feature(doc_cfg))] #![allow( // clippy is broken and shows wrong warnings @@ -281,14 +281,14 @@ //! # } //! ``` //! -//! [`DisplayFromStr`]: https://docs.rs/serde_with/3.1.0/serde_with/struct.DisplayFromStr.html -//! [`with_prefix!`]: https://docs.rs/serde_with/3.1.0/serde_with/macro.with_prefix.html -//! [feature flags]: https://docs.rs/serde_with/3.1.0/serde_with/guide/feature_flags/index.html -//! [skip_serializing_none]: https://docs.rs/serde_with/3.1.0/serde_with/attr.skip_serializing_none.html -//! [StringWithSeparator]: https://docs.rs/serde_with/3.1.0/serde_with/struct.StringWithSeparator.html -//! [user guide]: https://docs.rs/serde_with/3.1.0/serde_with/guide/index.html +//! [`DisplayFromStr`]: https://docs.rs/serde_with/3.2.0/serde_with/struct.DisplayFromStr.html +//! [`with_prefix!`]: https://docs.rs/serde_with/3.2.0/serde_with/macro.with_prefix.html +//! [feature flags]: https://docs.rs/serde_with/3.2.0/serde_with/guide/feature_flags/index.html +//! [skip_serializing_none]: https://docs.rs/serde_with/3.2.0/serde_with/attr.skip_serializing_none.html +//! [StringWithSeparator]: https://docs.rs/serde_with/3.2.0/serde_with/struct.StringWithSeparator.html +//! [user guide]: https://docs.rs/serde_with/3.2.0/serde_with/guide/index.html //! [with-annotation]: https://serde.rs/field-attrs.html#with -//! [as-annotation]: https://docs.rs/serde_with/3.1.0/serde_with/guide/serde_as/index.html +//! [as-annotation]: https://docs.rs/serde_with/3.2.0/serde_with/guide/serde_as/index.html #[cfg(feature = "alloc")] extern crate alloc; @@ -495,7 +495,7 @@ pub use serde_with_macros::*; /// # } /// ``` /// -/// [serde_as]: https://docs.rs/serde_with/3.1.0/serde_with/attr.serde_as.html +/// [serde_as]: https://docs.rs/serde_with/3.2.0/serde_with/attr.serde_as.html pub struct As(PhantomData); /// Adapter to convert from `serde_as` to the serde traits. @@ -927,7 +927,7 @@ pub struct BytesOrString; /// ``` /// /// [`chrono::Duration`]: ::chrono_0_4::Duration -/// [feature flag]: https://docs.rs/serde_with/3.1.0/serde_with/guide/feature_flags/index.html +/// [feature flag]: https://docs.rs/serde_with/3.2.0/serde_with/guide/feature_flags/index.html pub struct DurationSeconds< FORMAT: formats::Format = u64, STRICTNESS: formats::Strictness = formats::Strict, @@ -1059,7 +1059,7 @@ pub struct DurationSeconds< /// ``` /// /// [`chrono::Duration`]: ::chrono_0_4::Duration -/// [feature flag]: https://docs.rs/serde_with/3.1.0/serde_with/guide/feature_flags/index.html +/// [feature flag]: https://docs.rs/serde_with/3.2.0/serde_with/guide/feature_flags/index.html pub struct DurationSecondsWithFrac< FORMAT: formats::Format = f64, STRICTNESS: formats::Strictness = formats::Strict, @@ -1261,7 +1261,7 @@ pub struct DurationNanoSecondsWithFrac< /// [`SystemTime`]: std::time::SystemTime /// [`chrono::DateTime`]: ::chrono_0_4::DateTime /// [`chrono::DateTime`]: ::chrono_0_4::DateTime -/// [feature flag]: https://docs.rs/serde_with/3.1.0/serde_with/guide/feature_flags/index.html +/// [feature flag]: https://docs.rs/serde_with/3.2.0/serde_with/guide/feature_flags/index.html pub struct TimestampSeconds< FORMAT: formats::Format = i64, STRICTNESS: formats::Strictness = formats::Strict, @@ -1403,7 +1403,7 @@ pub struct TimestampSeconds< /// [`chrono::DateTime`]: ::chrono_0_4::DateTime /// [`chrono::DateTime`]: ::chrono_0_4::DateTime /// [NaiveDateTime]: ::chrono_0_4::NaiveDateTime -/// [feature flag]: https://docs.rs/serde_with/3.1.0/serde_with/guide/feature_flags/index.html +/// [feature flag]: https://docs.rs/serde_with/3.2.0/serde_with/guide/feature_flags/index.html pub struct TimestampSecondsWithFrac< FORMAT: formats::Format = f64, STRICTNESS: formats::Strictness = formats::Strict, diff --git a/serde_with_macros/CHANGELOG.md b/serde_with_macros/CHANGELOG.md index d43ad6f4..1b10d43f 100644 --- a/serde_with_macros/CHANGELOG.md +++ b/serde_with_macros/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [3.2.0] - 2023-08-04 + No changes. ## [3.1.0] - 2023-07-17 diff --git a/serde_with_macros/Cargo.toml b/serde_with_macros/Cargo.toml index 8915ea64..fb8f2279 100644 --- a/serde_with_macros/Cargo.toml +++ b/serde_with_macros/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Jonas Bushart"] name = "serde_with_macros" rust-version = "1.64" -version = "3.1.0" +version = "3.2.0" categories = ["encoding"] description = "proc-macro library for serde_with" diff --git a/serde_with_macros/src/lib.rs b/serde_with_macros/src/lib.rs index 124266f5..fbae76db 100644 --- a/serde_with_macros/src/lib.rs +++ b/serde_with_macros/src/lib.rs @@ -26,7 +26,7 @@ #![doc(test(attr(warn(rust_2018_idioms))))] // Not needed for 2018 edition and conflicts with `rust_2018_idioms` #![doc(test(no_crate_inject))] -#![doc(html_root_url = "https://docs.rs/serde_with_macros/3.1.0/")] +#![doc(html_root_url = "https://docs.rs/serde_with_macros/3.2.0/")] // Necessary to silence the warning about clippy::unknown_clippy_lints on nightly #![allow(renamed_and_removed_lints)] // Necessary for nightly clippy lints @@ -590,8 +590,8 @@ fn field_has_attribute(field: &Field, namespace: &str, name: &str) -> bool { /// } /// ``` /// -/// [`serde_as`]: https://docs.rs/serde_with/3.1.0/serde_with/guide/index.html -/// [re-exporting `serde_as`]: https://docs.rs/serde_with/3.1.0/serde_with/guide/serde_as/index.html#re-exporting-serde_as +/// [`serde_as`]: https://docs.rs/serde_with/3.2.0/serde_with/guide/index.html +/// [re-exporting `serde_as`]: https://docs.rs/serde_with/3.2.0/serde_with/guide/serde_as/index.html#re-exporting-serde_as #[proc_macro_attribute] pub fn serde_as(args: TokenStream, input: TokenStream) -> TokenStream { #[derive(FromMeta)] @@ -1008,7 +1008,7 @@ fn has_type_embedded(type_: &Type, embedded_type: &syn::Ident) -> bool { /// [`Display`]: std::fmt::Display /// [`FromStr`]: std::str::FromStr /// [cargo-toml-rename]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml -/// [serde-as-crate]: https://docs.rs/serde_with/3.1.0/serde_with/guide/serde_as/index.html#re-exporting-serde_as +/// [serde-as-crate]: https://docs.rs/serde_with/3.2.0/serde_with/guide/serde_as/index.html#re-exporting-serde_as /// [serde-crate]: https://serde.rs/container-attrs.html#crate #[proc_macro_derive(DeserializeFromStr, attributes(serde_with))] pub fn derive_deserialize_fromstr(item: TokenStream) -> TokenStream { @@ -1128,7 +1128,7 @@ fn deserialize_fromstr(mut input: DeriveInput, serde_with_crate_path: Path) -> T /// [`Display`]: std::fmt::Display /// [`FromStr`]: std::str::FromStr /// [cargo-toml-rename]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml -/// [serde-as-crate]: https://docs.rs/serde_with/3.1.0/serde_with/guide/serde_as/index.html#re-exporting-serde_as +/// [serde-as-crate]: https://docs.rs/serde_with/3.2.0/serde_with/guide/serde_as/index.html#re-exporting-serde_as /// [serde-crate]: https://serde.rs/container-attrs.html#crate #[proc_macro_derive(SerializeDisplay, attributes(serde_with))] pub fn derive_serialize_display(item: TokenStream) -> TokenStream {