{"action":"opened","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/32720","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/32720/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/32720/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/32720/events","html_url":"https://github.com/rust-lang/rust/issues/32720","id":145594549,"number":32720,"title":"Incorrect Add trait in book","user":{"login":"jyasskin","id":83420,"avatar_url":"https://avatars.githubusercontent.com/u/83420?v=3","gravatar_id":"","url":"https://api.github.com/users/jyasskin","html_url":"https://github.com/jyasskin","followers_url":"https://api.github.com/users/jyasskin/followers","following_url":"https://api.github.com/users/jyasskin/following{/other_user}","gists_url":"https://api.github.com/users/jyasskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jyasskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jyasskin/subscriptions","organizations_url":"https://api.github.com/users/jyasskin/orgs","repos_url":"https://api.github.com/users/jyasskin/repos","events_url":"https://api.github.com/users/jyasskin/events{/privacy}","received_events_url":"https://api.github.com/users/jyasskin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-04T06:20:53Z","updated_at":"2016-04-04T06:20:53Z","closed_at":null,"body":"https://github.com/rust-lang/rust/blob/master/src/doc/book/operators-and-overloading.md defines `Point`'s  `Add` trait as:\r\n\r\n```rust\r\nimpl Add for Point {\r\n    type Output = Point;\r\n\r\n    fn add(self, other: Point) -> Point {\r\n        Point { x: self.x + other.x, y: self.y + other.y }\r\n    }\r\n}\r\n```\r\n\r\nand then gives the example of using it as:\r\n\r\n```rust\r\n    let p1 = Point { x: 1, y: 0 };\r\n    let p2 = Point { x: 2, y: 3 };\r\n\r\n    let p3 = p1 + p2;\r\n```\r\n\r\nThis works, but it consumes both input points, contrary to the way most people expect `+` to work. that is, `let p4 = p1 + p2` fails to compile.\r\n\r\nI'd suggest making `Point` copyable by additionally deriving `Clone` and `Copy`, but you could also show the `&`-based trait implementation.\r\n\r\nI noticed this because of https://plus.google.com/+MattAustern/posts/eLJDWZFcd3J."}}