diff options
Diffstat (limited to 'tests/incremental/change_private_impl_method_cc/auxiliary/point.rs')
-rw-r--r-- | tests/incremental/change_private_impl_method_cc/auxiliary/point.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs b/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs new file mode 100644 index 000000000..2441da06b --- /dev/null +++ b/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs @@ -0,0 +1,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; + } +} |