11error[E0599]: no method named `hello` found for struct `A` in the current scope
2- --> $DIR/suggest-assoc-fn-call-without-receiver.rs:12 :8
2+ --> $DIR/suggest-assoc-fn-call-without-receiver.rs:20 :8
33 |
44LL | struct A {}
55 | -------- method `hello` not found for this struct
@@ -18,7 +18,7 @@ LL | fn hello(_a: i32) {}
1818 | ^^^^^^^^^^^^^^^^^
1919
2020error[E0599]: no method named `test` found for struct `A` in the current scope
21- --> $DIR/suggest-assoc-fn-call-without-receiver.rs:14 :8
21+ --> $DIR/suggest-assoc-fn-call-without-receiver.rs:22 :8
2222 |
2323LL | struct A {}
2424 | -------- method `test` not found for this struct
@@ -36,6 +36,44 @@ note: the candidate is defined in an impl for the type `A`
3636LL | fn test(_a: Self, _b: i32) {}
3737 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
3838
39- error: aborting due to 2 previous errors
39+ error[E0599]: no method named `hello` found for struct `B<&str>` in the current scope
40+ --> $DIR/suggest-assoc-fn-call-without-receiver.rs:26:8
41+ |
42+ LL | struct B<T> {
43+ | ----------- method `hello` not found for this struct
44+ ...
45+ LL | _b.hello(1);
46+ | ---^^^^^---
47+ | | |
48+ | | this is an associated function, not a method
49+ | help: use associated function syntax instead: `B::<&str>::hello(1)`
50+ |
51+ = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
52+ note: the candidate is defined in an impl for the type `B<T>`
53+ --> $DIR/suggest-assoc-fn-call-without-receiver.rs:14:5
54+ |
55+ LL | fn hello(_a: i32) {}
56+ | ^^^^^^^^^^^^^^^^^
57+
58+ error[E0599]: no method named `test` found for struct `B<&str>` in the current scope
59+ --> $DIR/suggest-assoc-fn-call-without-receiver.rs:28:8
60+ |
61+ LL | struct B<T> {
62+ | ----------- method `test` not found for this struct
63+ ...
64+ LL | _b.test(1);
65+ | ---^^^^---
66+ | | |
67+ | | this is an associated function, not a method
68+ | help: use associated function syntax instead: `B::<&str>::test(_b, 1)`
69+ |
70+ = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
71+ note: the candidate is defined in an impl for the type `B<T>`
72+ --> $DIR/suggest-assoc-fn-call-without-receiver.rs:15:5
73+ |
74+ LL | fn test(_a: Self, _b: i32) {}
75+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
76+
77+ error: aborting due to 4 previous errors
4078
4179For more information about this error, try `rustc --explain E0599`.
0 commit comments