diff --git a/CHANGELOG.md b/CHANGELOG.md index 997bd20d..06756fa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support [`ZeroizeOnDrop`](https://docs.rs/zeroize/1.5.0/zeroize/trait.ZeroizeOnDrop.html). +### Changed +- **Breaking Change**: Changed to attribute instead of derive proc macro. + ### Removed - **Breaking Change**: Remove support for `Zeroize(drop)`. diff --git a/README.md b/README.md index 64618b31..c491af32 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,15 @@ This will generate trait implementations for `Example` for any `T`, as opposed to std's derives, which would only implement these traits with `T: Trait` bound to the corresponding trait. +Multiple `derive_where` attributes can be added to an item, but only the +first one must use any path qualifications. + +```rust +#[derive_where::derive_where(Clone)] +#[derive_where(Debug)] +struct Example1(PhantomData); +``` + In addition, the following convenience options are available: ### Generic type bounds diff --git a/non-msrv-tests/tests/ui/non_item.rs b/non-msrv-tests/tests/ui/non_item.rs new file mode 100644 index 00000000..025d4e1a --- /dev/null +++ b/non-msrv-tests/tests/ui/non_item.rs @@ -0,0 +1,6 @@ +use derive_where::derive_where; + +#[derive_where(Clone)] +const _: () = (); + +fn main() {} diff --git a/non-msrv-tests/tests/ui/non_item.stderr b/non-msrv-tests/tests/ui/non_item.stderr new file mode 100644 index 00000000..62e20093 --- /dev/null +++ b/non-msrv-tests/tests/ui/non_item.stderr @@ -0,0 +1,5 @@ +error: expected one of: `struct`, `enum`, `union` + --> tests/ui/non_item.rs:4:1 + | +4 | const _: () = (); + | ^^^^^ diff --git a/src/lib.rs b/src/lib.rs index 37c40fef..770971da 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,16 @@ //! as opposed to std's derives, which would only implement these traits with //! `T: Trait` bound to the corresponding trait. //! +//! Multiple `derive_where` attributes can be added to an item, but only the +//! first one must use any path qualifications. +//! +//! ``` +//! # use std::marker::PhantomData; +//! #[derive_where::derive_where(Clone)] +//! #[derive_where(Debug)] +//! struct Example1(PhantomData); +//! ``` +//! //! In addition, the following convenience options are available: //! //! ## Generic type bounds