]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/issue-3973.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / ui / traits / issue-3973.rs
1 struct Point {
2     x: f64,
3     y: f64,
4 }
5
6 trait ToString_ {
7     fn to_string(&self) -> String;
8 }
9
10 impl ToString_ for Point {
11     fn new(x: f64, y: f64) -> Point {
12     //~^ ERROR method `new` is not a member of trait `ToString_`
13         Point { x: x, y: y }
14     }
15
16     fn to_string(&self) -> String {
17         format!("({}, {})", self.x, self.y)
18     }
19 }
20
21 fn main() {
22     let p = Point::new(0.0, 0.0);
23     //~^ ERROR no function or associated item named `new` found for struct `Point`
24     println!("{}", p.to_string());
25 }