]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
0bf4aa26 | 2 | #![allow(dead_code)] |
532ac7d7 | 3 | // aux-build:issue-3979-traits.rs |
c34b1796 | 4 | |
1a4d82fc JJ |
5 | extern crate issue_3979_traits; |
6 | use issue_3979_traits::{Positioned, Movable}; | |
223e47cc | 7 | |
c34b1796 | 8 | struct Point { x: isize, y: isize } |
223e47cc LB |
9 | |
10 | impl Positioned for Point { | |
c34b1796 | 11 | fn SetX(&mut self, x: isize) { |
223e47cc LB |
12 | self.x = x; |
13 | } | |
c34b1796 | 14 | fn X(&self) -> isize { |
223e47cc LB |
15 | self.x |
16 | } | |
17 | } | |
18 | ||
1a4d82fc | 19 | impl Movable for Point {} |
223e47cc LB |
20 | |
21 | pub fn main() { | |
22 | let mut p = Point{ x: 1, y: 2}; | |
23 | p.translate(3); | |
970d7e83 | 24 | assert_eq!(p.X(), 4); |
223e47cc | 25 | } |