diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a525c..9b3d7a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Update `derive_utils` to 0.15. This uses `#[automatically_derived]` on generated impls to improve coverage support. + ## [0.8.6] - 2024-08-23 - Disable `derive` feature of `syn` dependency. diff --git a/Cargo.toml b/Cargo.toml index da7db92..6bd293c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,7 +81,7 @@ trusted_len = [] # Note: futures, tokio, rayon, serde, and http-body are public dependencies. [dependencies] -derive_utils = "0.14.1" +derive_utils = "0.15" proc-macro2 = "1.0.60" quote = "1.0.25" syn = { version = "2.0.1", default-features = false, features = ["parsing", "printing", "clone-impls", "proc-macro", "full", "visit-mut"] } diff --git a/src/enum_derive.rs b/src/enum_derive.rs index b6fafd1..a24ef97 100644 --- a/src/enum_derive.rs +++ b/src/enum_derive.rs @@ -324,7 +324,9 @@ fn expand(args: TokenStream, input: TokenStream) -> Result { const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl #impl_generics MustNotImplDrop for #name #ty_generics #where_clause {} }; }); diff --git a/tests/expand/enum_derive/example-1.expanded.rs b/tests/expand/enum_derive/example-1.expanded.rs index f616900..7963e23 100644 --- a/tests/expand/enum_derive/example-1.expanded.rs +++ b/tests/expand/enum_derive/example-1.expanded.rs @@ -3,6 +3,7 @@ fn foo(x: i32) -> impl Iterator { __T1(__T1), __T2(__T2), } + #[automatically_derived] impl<__T1, __T2> ::core::iter::Iterator for __Enum1<__T1, __T2> where __T1: ::core::iter::Iterator, diff --git a/tests/expand/external/futures/async_buf_read.expanded.rs b/tests/expand/external/futures/async_buf_read.expanded.rs index dd97f3e..446cb3a 100644 --- a/tests/expand/external/futures/async_buf_read.expanded.rs +++ b/tests/expand/external/futures/async_buf_read.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::futures::io::AsyncBufRead for Enum where A: ::futures::io::AsyncBufRead, @@ -51,6 +52,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -59,7 +61,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/futures/async_read.expanded.rs b/tests/expand/external/futures/async_read.expanded.rs index c0c48a9..01dd58c 100644 --- a/tests/expand/external/futures/async_read.expanded.rs +++ b/tests/expand/external/futures/async_read.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::futures::io::AsyncRead for Enum where A: ::futures::io::AsyncRead, @@ -60,6 +61,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -68,7 +70,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/futures/async_seek.expanded.rs b/tests/expand/external/futures/async_seek.expanded.rs index cdd8f47..4e443f7 100644 --- a/tests/expand/external/futures/async_seek.expanded.rs +++ b/tests/expand/external/futures/async_seek.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::futures::io::AsyncSeek for Enum where A: ::futures::io::AsyncSeek, @@ -35,6 +36,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -43,7 +45,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/futures/async_write.expanded.rs b/tests/expand/external/futures/async_write.expanded.rs index c3b23ed..4e76cef 100644 --- a/tests/expand/external/futures/async_write.expanded.rs +++ b/tests/expand/external/futures/async_write.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::futures::io::AsyncWrite for Enum where A: ::futures::io::AsyncWrite, @@ -104,6 +105,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -112,7 +114,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/futures/sink.expanded.rs b/tests/expand/external/futures/sink.expanded.rs index 3250c14..7943008 100644 --- a/tests/expand/external/futures/sink.expanded.rs +++ b/tests/expand/external/futures/sink.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::futures::sink::Sink<__Item> for Enum where A: ::futures::sink::Sink<__Item>, @@ -94,6 +95,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -102,7 +104,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/futures/stream.expanded.rs b/tests/expand/external/futures/stream.expanded.rs index 6e118c3..8c03e7d 100644 --- a/tests/expand/external/futures/stream.expanded.rs +++ b/tests/expand/external/futures/stream.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::futures::stream::Stream for Enum where A: ::futures::stream::Stream, @@ -40,6 +41,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -48,7 +50,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/http_body/body.expanded.rs b/tests/expand/external/http_body/body.expanded.rs index e313446..864334f 100644 --- a/tests/expand/external/http_body/body.expanded.rs +++ b/tests/expand/external/http_body/body.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::http_body::Body for Enum where A: ::http_body::Body, @@ -54,6 +55,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -62,7 +64,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/rayon/indexed_parallel_iterator.expanded.rs b/tests/expand/external/rayon/indexed_parallel_iterator.expanded.rs index 9df9adc..c910ee1 100644 --- a/tests/expand/external/rayon/indexed_parallel_iterator.expanded.rs +++ b/tests/expand/external/rayon/indexed_parallel_iterator.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::rayon::iter::ParallelIterator for Enum where A: ::rayon::iter::ParallelIterator, @@ -34,6 +35,7 @@ where } } } +#[automatically_derived] impl ::rayon::iter::IndexedParallelIterator for Enum where A: ::rayon::iter::IndexedParallelIterator, diff --git a/tests/expand/external/rayon/parallel_extend.expanded.rs b/tests/expand/external/rayon/parallel_extend.expanded.rs index f238a79..a3ca232 100644 --- a/tests/expand/external/rayon/parallel_extend.expanded.rs +++ b/tests/expand/external/rayon/parallel_extend.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::rayon::iter::ParallelExtend<__T> for Enum where A: ::rayon::iter::ParallelExtend<__T>, diff --git a/tests/expand/external/rayon/parallel_iterator.expanded.rs b/tests/expand/external/rayon/parallel_iterator.expanded.rs index 92c7d21..43ab0e3 100644 --- a/tests/expand/external/rayon/parallel_iterator.expanded.rs +++ b/tests/expand/external/rayon/parallel_iterator.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::rayon::iter::ParallelIterator for Enum where A: ::rayon::iter::ParallelIterator, diff --git a/tests/expand/external/serde/serialize.expanded.rs b/tests/expand/external/serde/serialize.expanded.rs index 9b4ea74..a34751f 100644 --- a/tests/expand/external/serde/serialize.expanded.rs +++ b/tests/expand/external/serde/serialize.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::serde::ser::Serialize for Enum where A: ::serde::ser::Serialize, diff --git a/tests/expand/external/tokio/async_buf_read.expanded.rs b/tests/expand/external/tokio/async_buf_read.expanded.rs index 0003659..6ee6d3e 100644 --- a/tests/expand/external/tokio/async_buf_read.expanded.rs +++ b/tests/expand/external/tokio/async_buf_read.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::tokio::io::AsyncBufRead for Enum where A: ::tokio::io::AsyncBufRead, @@ -49,6 +50,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -57,7 +59,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/tokio/async_read.expanded.rs b/tests/expand/external/tokio/async_read.expanded.rs index 343c4ab..ebdb12c 100644 --- a/tests/expand/external/tokio/async_read.expanded.rs +++ b/tests/expand/external/tokio/async_read.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::tokio::io::AsyncRead for Enum where A: ::tokio::io::AsyncRead, @@ -34,6 +35,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -42,7 +44,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/tokio/async_seek.expanded.rs b/tests/expand/external/tokio/async_seek.expanded.rs index f916d82..7301d06 100644 --- a/tests/expand/external/tokio/async_seek.expanded.rs +++ b/tests/expand/external/tokio/async_seek.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::tokio::io::AsyncSeek for Enum where A: ::tokio::io::AsyncSeek, @@ -52,6 +53,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -60,7 +62,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/external/tokio/async_write.expanded.rs b/tests/expand/external/tokio/async_write.expanded.rs index 679d940..957a61c 100644 --- a/tests/expand/external/tokio/async_write.expanded.rs +++ b/tests/expand/external/tokio/async_write.expanded.rs @@ -4,6 +4,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::tokio::io::AsyncWrite for Enum where A: ::tokio::io::AsyncWrite, @@ -106,6 +107,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -114,7 +116,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/std/debug.expanded.rs b/tests/expand/std/debug.expanded.rs index e0725c9..2fdfb86 100644 --- a/tests/expand/std/debug.expanded.rs +++ b/tests/expand/std/debug.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::fmt::Debug for Enum where A: ::core::fmt::Debug, diff --git a/tests/expand/std/error.expanded.rs b/tests/expand/std/error.expanded.rs index e169bcd..8c41daf 100644 --- a/tests/expand/std/error.expanded.rs +++ b/tests/expand/std/error.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::fmt::Display for Enum where A: ::core::fmt::Display, @@ -16,6 +17,7 @@ where } } } +#[automatically_derived] impl ::core::fmt::Debug for Enum where A: ::core::fmt::Debug, @@ -29,6 +31,7 @@ where } } } +#[automatically_derived] impl ::std::error::Error for Enum where A: ::std::error::Error, diff --git a/tests/expand/std/future.expanded.rs b/tests/expand/std/future.expanded.rs index f9b8ca8..d2af107 100644 --- a/tests/expand/std/future.expanded.rs +++ b/tests/expand/std/future.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::future::Future for Enum where A: ::core::future::Future, @@ -32,6 +33,7 @@ where } } } +#[automatically_derived] impl ::core::marker::Unpin for Enum where A: ::core::marker::Unpin, @@ -40,7 +42,9 @@ where const _: () = { trait MustNotImplDrop {} #[allow(clippy::drop_bounds, drop_bounds)] + #[automatically_derived] impl MustNotImplDrop for T {} + #[automatically_derived] impl MustNotImplDrop for Enum {} }; fn main() {} diff --git a/tests/expand/std/io/buf_read.expanded.rs b/tests/expand/std/io/buf_read.expanded.rs index 97844ab..ea68b82 100644 --- a/tests/expand/std/io/buf_read.expanded.rs +++ b/tests/expand/std/io/buf_read.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::std::io::Read for Enum where A: ::std::io::Read, @@ -53,6 +54,7 @@ where } } } +#[automatically_derived] impl ::std::io::BufRead for Enum where A: ::std::io::BufRead, diff --git a/tests/expand/std/io/read.expanded.rs b/tests/expand/std/io/read.expanded.rs index 8f6b727..fb06bf5 100644 --- a/tests/expand/std/io/read.expanded.rs +++ b/tests/expand/std/io/read.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::std::io::Read for Enum where A: ::std::io::Read, diff --git a/tests/expand/std/io/seek.expanded.rs b/tests/expand/std/io/seek.expanded.rs index f6acda3..d06f825 100644 --- a/tests/expand/std/io/seek.expanded.rs +++ b/tests/expand/std/io/seek.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::std::io::Seek for Enum where A: ::std::io::Seek, diff --git a/tests/expand/std/io/write.expanded.rs b/tests/expand/std/io/write.expanded.rs index b8b7745..e742561 100644 --- a/tests/expand/std/io/write.expanded.rs +++ b/tests/expand/std/io/write.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::std::io::Write for Enum where A: ::std::io::Write, diff --git a/tests/expand/std/iter/double_ended_iterator.expanded.rs b/tests/expand/std/iter/double_ended_iterator.expanded.rs index ffd1634..adbf825 100644 --- a/tests/expand/std/iter/double_ended_iterator.expanded.rs +++ b/tests/expand/std/iter/double_ended_iterator.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::iter::Iterator for Enum where A: ::core::iter::Iterator, @@ -124,6 +125,7 @@ where } } } +#[automatically_derived] impl ::core::iter::DoubleEndedIterator for Enum where A: ::core::iter::DoubleEndedIterator, diff --git a/tests/expand/std/iter/exact_size_iterator.expanded.rs b/tests/expand/std/iter/exact_size_iterator.expanded.rs index 50c3f41..97a5507 100644 --- a/tests/expand/std/iter/exact_size_iterator.expanded.rs +++ b/tests/expand/std/iter/exact_size_iterator.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::iter::Iterator for Enum where A: ::core::iter::Iterator, @@ -124,6 +125,7 @@ where } } } +#[automatically_derived] impl ::core::iter::ExactSizeIterator for Enum where A: ::core::iter::ExactSizeIterator, diff --git a/tests/expand/std/iter/extend.expanded.rs b/tests/expand/std/iter/extend.expanded.rs index b0072b6..4fc2536 100644 --- a/tests/expand/std/iter/extend.expanded.rs +++ b/tests/expand/std/iter/extend.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::iter::Extend<__A> for Enum where A: ::core::iter::Extend<__A>, diff --git a/tests/expand/std/iter/fused_iterator.expanded.rs b/tests/expand/std/iter/fused_iterator.expanded.rs index 576eab0..761e61b 100644 --- a/tests/expand/std/iter/fused_iterator.expanded.rs +++ b/tests/expand/std/iter/fused_iterator.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::iter::Iterator for Enum where A: ::core::iter::Iterator, @@ -124,6 +125,7 @@ where } } } +#[automatically_derived] impl ::core::iter::FusedIterator for Enum where A: ::core::iter::FusedIterator, diff --git a/tests/expand/std/iter/iterator.expanded.rs b/tests/expand/std/iter/iterator.expanded.rs index 20354a8..2ba5092 100644 --- a/tests/expand/std/iter/iterator.expanded.rs +++ b/tests/expand/std/iter/iterator.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::iter::Iterator for Enum where A: ::core::iter::Iterator, diff --git a/tests/expand/std/iter/trusted_len.expanded.rs b/tests/expand/std/iter/trusted_len.expanded.rs index e70a373..1069ef6 100644 --- a/tests/expand/std/iter/trusted_len.expanded.rs +++ b/tests/expand/std/iter/trusted_len.expanded.rs @@ -3,6 +3,7 @@ enum Enum { A(A), B(B), } +#[automatically_derived] impl ::core::iter::Iterator for Enum where A: ::core::iter::Iterator, @@ -124,6 +125,7 @@ where } } } +#[automatically_derived] unsafe impl ::core::iter::TrustedLen for Enum where A: ::core::iter::TrustedLen,