rust/tests/incremental/change_private_impl_method_cc/auxiliary/point.rs
2023-01-11 09:32:08 +00:00

26 lines
452 B
Rust

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;
}
}