From 77ec7e7612d9fe07b2a6a9e4ff83900cad008e96 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 1 Apr 2025 22:12:56 +0000 Subject: [PATCH 1/3] [meta] update changelog --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9338e3b..45c2ac5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ # Changelog -## Unreleased +## [0.1.3] - 2025-04-01 ### Fixed -- The `Diffable` derive macro now produces code + errors when the only errors are duplicate struct and field attribute errors. +The `Diffable` derive macro now produces both code and errors when the only errors are duplicate struct and field attribute errors. + +Thanks to [schneems](https://github.com/schneems) for your first contribution; be sure to read [his blog post](https://www.schneems.com/2025/03/26/a-daft-procmacro-trick-how-to-emit-partialcode-errors/) about Daft's error handling! ## [0.1.2] - 2025-03-10 From 7f3525a1a611a8a1c9b8323a61afaf44eebf92c9 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 1 Apr 2025 22:13:38 +0000 Subject: [PATCH 2/3] [daft-derive] version 0.1.3 --- Cargo.lock | 2 +- Cargo.toml | 2 +- daft-derive/Cargo.toml | 2 +- daft-derive/src/lib.rs | 2 +- daft/README.md | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 76f500a..107edd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,7 +160,7 @@ dependencies = [ [[package]] name = "daft-derive" -version = "0.1.2" +version = "0.1.3" dependencies = [ "daft", "datatest-stable", diff --git a/Cargo.toml b/Cargo.toml index 15da7e2..32eb31d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ datatest-stable = "0.3.2" daft = { path = "daft" } # Use a fixed version number for daft-derive, so daft and daft-derive are always # in sync -- the two are released in lockstep. -daft-derive = { version = "=0.1.2", path = "daft-derive" } +daft-derive = { version = "=0.1.3", path = "daft-derive" } expectorate = "1.1.0" newtype-uuid = "1.2.1" oxnet = "0.1.0" diff --git a/daft-derive/Cargo.toml b/daft-derive/Cargo.toml index 124bc9c..a498da8 100644 --- a/daft-derive/Cargo.toml +++ b/daft-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "daft-derive" -version = "0.1.2" +version = "0.1.3" description = "Derive macro for daft" readme = "README.md" categories = ["development-tools"] diff --git a/daft-derive/src/lib.rs b/daft-derive/src/lib.rs index 5ea5a67..c1914dd 100644 --- a/daft-derive/src/lib.rs +++ b/daft-derive/src/lib.rs @@ -3,7 +3,7 @@ //! For more information about daft, see [its documentation](https://docs.rs/daft). // Setting html_root_url allows daft's readme to have links to daft-derive. This // line is updated by cargo-release. -#![doc(html_root_url = "https://docs.rs/daft-derive/0.1.2")] +#![doc(html_root_url = "https://docs.rs/daft-derive/0.1.3")] mod internals; use quote::ToTokens; diff --git a/daft/README.md b/daft/README.md index 65e15b8..d03c4e6 100644 --- a/daft/README.md +++ b/daft/README.md @@ -11,7 +11,7 @@ Daft is a library to perform semantic diffs of Rust data structures. Daft consists of a trait called [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html), along with [a derive -macro](https://docs.rs/daft-derive/0.1.2/daft_derive/derive.Diffable.html) by the same name. This trait represents the +macro](https://docs.rs/daft-derive/0.1.3/daft_derive/derive.Diffable.html) by the same name. This trait represents the notion of a type for which two members can be simultaneously compared. ## Features @@ -233,7 +233,7 @@ assert_eq!( #### Struct diffs -For structs, the [`Diffable`](https://docs.rs/daft-derive/0.1.2/daft_derive/derive.Diffable.html) derive macro generates +For structs, the [`Diffable`](https://docs.rs/daft-derive/0.1.3/daft_derive/derive.Diffable.html) derive macro generates a diff type with a field corresponding to each field type. Each field must implement [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html). @@ -378,7 +378,7 @@ impl Diffable for Identifier { ### Type and lifetime parameters -If a type parameter is specified, the [`Diffable`](https://docs.rs/daft-derive/0.1.2/daft_derive/derive.Diffable.html) derive +If a type parameter is specified, the [`Diffable`](https://docs.rs/daft-derive/0.1.3/daft_derive/derive.Diffable.html) derive macro for structs normally requires that the type parameter implement `Diffable`. This is not required if the field is annotated with `#[daft(leaf)]`. From b29c31fdf9e9f9e75a653cfac3af0f5acfe5a569 Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 1 Apr 2025 22:13:39 +0000 Subject: [PATCH 3/3] [daft] version 0.1.3 --- Cargo.lock | 2 +- daft/Cargo.toml | 2 +- daft/README.md | 36 ++++++++++++++++++------------------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 107edd3..59361fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,7 +149,7 @@ dependencies = [ [[package]] name = "daft" -version = "0.1.2" +version = "0.1.3" dependencies = [ "daft-derive", "newtype-uuid", diff --git a/daft/Cargo.toml b/daft/Cargo.toml index 9582d29..5a9b1bb 100644 --- a/daft/Cargo.toml +++ b/daft/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "daft" -version = "0.1.2" +version = "0.1.3" description = "Structural diffs of Rust data structures" readme = "README.md" categories = ["development-tools", "no-std::no-alloc"] diff --git a/daft/README.md b/daft/README.md index d03c4e6..5b0d6fe 100644 --- a/daft/README.md +++ b/daft/README.md @@ -10,7 +10,7 @@ Daft is a library to perform semantic diffs of Rust data structures. -Daft consists of a trait called [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html), along with [a derive +Daft consists of a trait called [`Diffable`](https://docs.rs/daft/0.1.3/daft/diffable/trait.Diffable.html), along with [a derive macro](https://docs.rs/daft-derive/0.1.3/daft_derive/derive.Diffable.html) by the same name. This trait represents the notion of a type for which two members can be simultaneously compared. @@ -62,10 +62,10 @@ reversed. Currently, daft comes with a few kinds of diff types: -#### [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html) instances +#### [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html) instances -A [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html) represents a logical *leaf node* or *base case* in a diff, i.e. a -point at which diffing stops. [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html) instances are used for: +A [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html) represents a logical *leaf node* or *base case* in a diff, i.e. a +point at which diffing stops. [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html) instances are used for: * *Scalar* or *primitive types* like `i32`, `String`, `bool`, etc. * *Enums*, since diffing across variants is usually not meaningful. @@ -125,8 +125,8 @@ assert_eq!(diff.after, &after); #### Map diffs -For [`BTreeMap`] and [`HashMap`], daft has corresponding [`BTreeMapDiff`](https://docs.rs/daft/0.1.2/daft/alloc_impls/struct.BTreeMapDiff.html) -and [`HashMapDiff`](https://docs.rs/daft/0.1.2/daft/std_impls/struct.HashMapDiff.html) types. These types have fields for *common*, *added*, +For [`BTreeMap`] and [`HashMap`], daft has corresponding [`BTreeMapDiff`](https://docs.rs/daft/0.1.3/daft/alloc_impls/struct.BTreeMapDiff.html) +and [`HashMapDiff`](https://docs.rs/daft/0.1.3/daft/std_impls/struct.HashMapDiff.html) types. These types have fields for *common*, *added*, and *removed* entries. Map diffs are performed eagerly for keys, but values are stored as leaf @@ -181,8 +181,8 @@ assert_eq!( #### Set diffs -For [`BTreeSet`] and [`HashSet`], daft has corresponding [`BTreeSetDiff`](https://docs.rs/daft/0.1.2/daft/alloc_impls/struct.BTreeSetDiff.html) -and [`HashSetDiff`](https://docs.rs/daft/0.1.2/daft/std_impls/struct.HashSetDiff.html) types. These types have fields for *common*, *added*, +For [`BTreeSet`] and [`HashSet`], daft has corresponding [`BTreeSetDiff`](https://docs.rs/daft/0.1.3/daft/alloc_impls/struct.BTreeSetDiff.html) +and [`HashSetDiff`](https://docs.rs/daft/0.1.3/daft/std_impls/struct.HashSetDiff.html) types. These types have fields for *common*, *added*, and *removed* entries. Set diffs are performed eagerly. @@ -204,7 +204,7 @@ assert_eq!(diff.removed, [&0, &1, &2].into_iter().collect()); #### Tuple diffs -For a tuple like `(A, B, C)`, the [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html) implementation is recursive: +For a tuple like `(A, B, C)`, the [`Diffable`](https://docs.rs/daft/0.1.3/daft/diffable/trait.Diffable.html) implementation is recursive: the diff resolves to `(A::Diff, B::Diff, C::Diff)`. ##### Example @@ -235,22 +235,22 @@ assert_eq!( For structs, the [`Diffable`](https://docs.rs/daft-derive/0.1.3/daft_derive/derive.Diffable.html) derive macro generates a diff type with a field corresponding to each field type. Each field must -implement [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html). +implement [`Diffable`](https://docs.rs/daft/0.1.3/daft/diffable/trait.Diffable.html). A struct `Foo` gets a corresponding `FooDiff` struct, which has fields corresponding to each field in `Foo`. ##### Struct options -* `#[daft(leaf)]`: if a **struct** is annotated with this, the [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html) - implementation for the struct will be a [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html) instead of a recursive +* `#[daft(leaf)]`: if a **struct** is annotated with this, the [`Diffable`](https://docs.rs/daft/0.1.3/daft/diffable/trait.Diffable.html) + implementation for the struct will be a [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html) instead of a recursive diff. ##### Field options * `#[daft(leaf)]`: if a **struct field** is annotated with this, the generated - struct’s corresponding field will be a [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html), regardless of the field’s - `Diff` type (or even whether it implements [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html) at all). + struct’s corresponding field will be a [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html), regardless of the field’s + `Diff` type (or even whether it implements [`Diffable`](https://docs.rs/daft/0.1.3/daft/diffable/trait.Diffable.html) at all). * `#[daft(ignore)]`: the generated struct’s corresponding field is not included in the diff. @@ -349,7 +349,7 @@ assert_eq!(diff.plain, Leaf { before: &PlainStruct(1), after: &PlainStruct(2) }) #### Custom diff types -The [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html) trait can also be implemented manually for custom behavior. +The [`Diffable`](https://docs.rs/daft/0.1.3/daft/diffable/trait.Diffable.html) trait can also be implemented manually for custom behavior. In general, most custom implementations will likely use one of the built-in diff types directly. @@ -443,9 +443,9 @@ this crate and a great alternative. Daft diverges from diffus in a few ways: In practice, we’ve found that diffing enums across different variants is less useful than it first appears. -* Daft has the notion of a [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html) type, which represents an atomic unit. - (For example, the [`Diffable`](https://docs.rs/daft/0.1.2/daft/diffable/trait.Diffable.html) implementation for `i32` is a [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html).) - [`Leaf`](https://docs.rs/daft/0.1.2/daft/leaf/struct.Leaf.html)s are also used for enums, as well as in any other place where lazy +* Daft has the notion of a [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html) type, which represents an atomic unit. + (For example, the [`Diffable`](https://docs.rs/daft/0.1.3/daft/diffable/trait.Diffable.html) implementation for `i32` is a [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html).) + [`Leaf`](https://docs.rs/daft/0.1.3/daft/leaf/struct.Leaf.html)s are also used for enums, as well as in any other place where lazy diffing is desired. * Diffus has a `Same` trait, which is like `Eq` except it’s also implemented