File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ trait Trait {
2+ fn func ( ) { }
3+ }
4+
5+ impl Trait for i32 { }
6+
7+ fn main ( ) {
8+ let x: i32 = 123 ;
9+ x. func ( ) ; //~ERROR no method
10+ }
Original file line number Diff line number Diff line change 1+ error[E0599]: no method named `func` found for type `i32` in the current scope
2+ --> $DIR/issue-102354.rs:9:7
3+ |
4+ LL | x.func();
5+ | ^^^^ this is an associated function, not a method
6+ |
7+ = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
8+ note: the candidate is defined in the trait `Trait`
9+ --> $DIR/issue-102354.rs:2:5
10+ |
11+ LL | fn func() {}
12+ | ^^^^^^^^^
13+ help: use associated function syntax instead
14+ |
15+ LL | i32::func();
16+ | ~~~~~~~~~
17+ help: disambiguate the associated function for the candidate
18+ |
19+ LL | <i32 as Trait>::func(x);
20+ | ~~~~~~~~~~~~~~~~~~~~~~~
21+
22+ error: aborting due to previous error
23+
24+ For more information about this error, try `rustc --explain E0599`.
You can’t perform that action at this time.
0 commit comments