Open
Description
Define "Returns a copy of the value" to mean a == b -> a == b.clone()
.
Original unworkable proposal (see discussion below):
Currently, clone explicitly doesn't guarantee that the following are always indistinguishable:
let a = f();
let b = g();
let c = b.clone();
h(a, b);
let a = f();
let b = g();
let c = b.clone();
h(a, c);
This is unfortunate. However, the trait does say that Clone::clone()
"Returns a copy of the value." which could imply indistinguishably (i.e., a copy of a value is indistinguishable from the original). It would be nice to make this explicit (so that, e.g., a == b
implies a == b.clone()
).
/cc #1203