auto merge of #19899 : japaric/rust/unops-by-value, r=nikomatsakis

- The following operator traits now take their argument by value: `Neg`, `Not`. This breaks all existing implementations of these traits.

- The unary operation `OP a` now "desugars" to `OpTrait::op_method(a)` and consumes its argument.

[breaking-change]

---

r? @nikomatsakis This PR is very similar to the binops-by-value PR
cc @aturon
This commit is contained in:
bors 2014-12-19 06:12:01 +00:00
commit 6bdce25e15
10 changed files with 195 additions and 14 deletions

View file

@ -31,13 +31,13 @@ impl ops::Sub<Point,Point> for Point {
}
impl ops::Neg<Point> for Point {
fn neg(&self) -> Point {
fn neg(self) -> Point {
Point {x: -self.x, y: -self.y}
}
}
impl ops::Not<Point> for Point {
fn not(&self) -> Point {
fn not(self) -> Point {
Point {x: !self.x, y: !self.y }
}
}