You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 471d4a2, the ActualT changed from an associated type to a type parameter. I think it is a good change, but is ActualT: Copy still required? In #323, there was some discussions about lifetime problems, but I don't think that is still valid now because the lifetime of the object being matched is not tied to the matcher anymore.
The comment in the code mentioned:
// `ActualT` requires `Copy` so that `actual` could be passed to `matches` and// if it fails passed to `explain_match`. We can relax this constraint later by// requiring only `Clone`.
But Copy in rust is generally considered cheap (if object is so large that memcpy is expensive, then the type probably shouldn't implement Copy in the first place), so there is no harm to take actual: &ActualT instead. If ActualT is Copy, the implementer can dereference it by themselves. This simplify a lot of lifetime problems when implementing custom matchers.