diff --git a/CHANGELOG.md b/CHANGELOG.md index a9805322..e10b5014 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ([#300](https://github.com/JelteF/derive_more/pull/300)) - `#[inline]` attributes to `IsVariant` and `Debug` implementations. ([#334](https://github.com/JelteF/derive_more/pull/334) +- Add `#[track_caller]` to `Add`, `Mul`, `AddAssign` and `MulAssign` derives + ([#378](https://github.com/JelteF/derive_more/pull/378) + ### Changed diff --git a/impl/src/add_assign_like.rs b/impl/src/add_assign_like.rs index 49510eb7..7d476732 100644 --- a/impl/src/add_assign_like.rs +++ b/impl/src/add_assign_like.rs @@ -31,6 +31,7 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream { #[automatically_derived] impl #impl_generics derive_more::#trait_ident for #input_type #ty_generics #where_clause { #[inline] + #[track_caller] fn #method_ident(&mut self, rhs: #input_type #ty_generics) { #( #exprs; )* } diff --git a/impl/src/add_like.rs b/impl/src/add_like.rs index 095bf37f..097a89c6 100644 --- a/impl/src/add_like.rs +++ b/impl/src/add_like.rs @@ -46,6 +46,7 @@ pub fn expand(input: &DeriveInput, trait_name: &str) -> TokenStream { type Output = #output_type; #[inline] + #[track_caller] fn #method_ident(self, rhs: #input_type #ty_generics) -> #output_type { #block } diff --git a/impl/src/mul_assign_like.rs b/impl/src/mul_assign_like.rs index 8e3f2cb7..b5fb4e50 100644 --- a/impl/src/mul_assign_like.rs +++ b/impl/src/mul_assign_like.rs @@ -55,6 +55,7 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result for #input_type #ty_generics #where_clause { #[inline] + #[track_caller] fn #method_ident(&mut self, rhs: #scalar_ident) { #( #exprs; )* } diff --git a/impl/src/mul_like.rs b/impl/src/mul_like.rs index d06372f3..c8a2ffac 100644 --- a/impl/src/mul_like.rs +++ b/impl/src/mul_like.rs @@ -53,6 +53,7 @@ pub fn expand(input: &DeriveInput, trait_name: &'static str) -> Result #input_type #ty_generics { #body }