summaryrefslogtreecommitdiffstats
path: root/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs
blob: 2441da06bc820fd53c83b39ae7af3b61720e6173 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pub struct Point {
    pub x: f32,
    pub y: f32,
}

impl Point {
    fn distance_squared(&self) -> f32 {
        #[cfg(cfail1)]
        return self.x + self.y;

        #[cfg(cfail2)]
        return self.x * self.x + self.y * self.y;
    }

    pub fn distance_from_origin(&self) -> f32 {
        self.distance_squared().sqrt()
    }
}

impl Point {
    pub fn translate(&mut self, x: f32, y: f32) {
        self.x += x;
        self.y += y;
    }
}