blob: 06959b5d765832cdcf6a51bbf4c0ecccbd3fc5fe (
plain)
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
|
This error occurs when you defined methods or associated functions with same
name.
Erroneous code example:
```compile_fail,E0592
struct Foo;
impl Foo {
fn bar() {} // previous definition here
}
impl Foo {
fn bar() {} // duplicate definition here
}
```
A similar error is E0201. The difference is whether there is one declaration
block or not. To avoid this error, you must give each `fn` a unique name.
```
struct Foo;
impl Foo {
fn bar() {}
}
impl Foo {
fn baz() {} // define with different name
}
```
|