Open yubrot opened 3 years ago
This will be fixed if the macro expansion uses UFCS Clone::clone(arg)
instead of arg.clone()
, ie #111
As I wrote there, the macro can be forced to use UFCS by annotating the borrow fields with clone_with = "Clone::clone"
, which for OP's case means:
use derivative::*;
#[derive(Derivative, Debug)]
#[derivative(Clone(bound = ""), Copy(bound = ""))]
pub struct T<'a, A> {
#[derivative(Clone(clone_with = "Clone::clone"))]
a: &'a String,
#[derivative(Clone(clone_with = "Clone::clone"))]
b: &'a A,
}
Describe the bug The following code will fail to derive.
To Reproduce
Expected behavior
derive
succeeds.Errors
Version (please complete the following information):