On 2014-06-12, at 19:08, Patrick Walton <[email protected]> wrote:
> On 6/11/14 6:27 AM, SiegeLord wrote:
>> So, I think the situation is pretty bad. What can be done to fix it?
>
> Seems to me we can just make the overloaded operator traits take by-value
> self.
I definitely wouldn't want to see something like the following:
pub trait GreaterByOne<T> {
fn greater_by_one(self) -> Self;
}
pub fn my_algorithm<X, T: GreaterByOne<X> + Add<T, T>>(value: T) -> T {
value.greater_by_one() +
value.greater_by_one() // error: use of moved value: `value`
}
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev