File: disambiguate-associated-function-first-arg.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (67 lines) | stat: -rw-r--r-- 2,234 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
error[E0599]: no method named `new` found for struct `A` in the current scope
  --> $DIR/disambiguate-associated-function-first-arg.rs:5:8
   |
LL | struct A {}
   | -------- method `new` not found for this struct
...
LL |     _a.new(1);
   |        ^^^ this is an associated function, not a method
   |
   = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
note: candidate #1 is defined in the trait `M`
  --> $DIR/disambiguate-associated-function-first-arg.rs:10:5
   |
LL |     fn new(_a: i32);
   |     ^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `N`
  --> $DIR/disambiguate-associated-function-first-arg.rs:17:5
   |
LL |     fn new(_a: Self, _b: i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #3 is defined in the trait `O`
  --> $DIR/disambiguate-associated-function-first-arg.rs:24:5
   |
LL |     fn new(_a: Self, _b: i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #1
   |
LL |     <A as M>::new(1);
   |     ~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #2
   |
LL |     <A as N>::new(_a, 1);
   |     ~~~~~~~~~~~~~~~~~~~~
help: disambiguate the associated function for candidate #3
   |
LL |     <A as O>::new(_a, 1);
   |     ~~~~~~~~~~~~~~~~~~~~

error[E0034]: multiple applicable items in scope
  --> $DIR/disambiguate-associated-function-first-arg.rs:47:7
   |
LL |     S.f();
   |       ^ multiple `f` found
   |
note: candidate #1 is defined in an impl of the trait `TraitA` for the type `T`
  --> $DIR/disambiguate-associated-function-first-arg.rs:40:5
   |
LL |     fn f(self) {}
   |     ^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `TraitB` for the type `T`
  --> $DIR/disambiguate-associated-function-first-arg.rs:43:5
   |
LL |     fn f(self) {}
   |     ^^^^^^^^^^
help: disambiguate the method for candidate #1
   |
LL |     TraitA::f(S);
   |     ~~~~~~~~~~~~
help: disambiguate the method for candidate #2
   |
LL |     TraitB::f(S);
   |     ~~~~~~~~~~~~

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0034, E0599.
For more information about an error, try `rustc --explain E0034`.