]> git.lizzy.rs Git - rust.git/blob - tests/ui/resolve/associated-fn-called-as-fn.rs
Rollup merge of #106244 - atouchet:readme3, r=workingjubilee
[rust.git] / tests / ui / resolve / associated-fn-called-as-fn.rs
1 struct S;
2 impl Foo for S {
3     fn parse(s:&str) {
4         for c in s.chars() {
5             match c {
6                 '0'..='9' => collect_primary(&c), //~ ERROR cannot find function `collect_primary`
7                 //~^ HELP you might have meant to call the associated function
8                 '+' | '-' => println!("We got a sign: {}", c),
9                 _ => println!("Not a number!")
10             }
11         }
12     }
13 }
14 trait Foo {
15     fn collect_primary(ch:&char) { }
16     fn parse(s:&str);
17 }
18 trait Bar {
19     fn collect_primary(ch:&char) { }
20     fn parse(s:&str) {
21         for c in s.chars() {
22             match c {
23                 '0'..='9' => collect_primary(&c), //~ ERROR cannot find function `collect_primary`
24                 //~^ HELP you might have meant to call the associated function
25                 '+' | '-' => println!("We got a sign: {}", c),
26                 _ => println!("Not a number!")
27             }
28         }
29     }
30 }
31
32 fn main() {}