Fix examples
This commit is contained in:
parent
047f9bc94d
commit
e252aaec70
1 changed files with 17 additions and 5 deletions
|
|
@ -3797,22 +3797,34 @@ E0592: r##"
|
|||
This error occurs when you defined methods or associated functions with same
|
||||
name.
|
||||
|
||||
For example, in the following code:
|
||||
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 have to give them one name each.
|
||||
|
||||
```
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
fn bar() {}
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn bar() {}
|
||||
fn baz() {} // define with different name
|
||||
}
|
||||
```
|
||||
|
||||
A similar error is E0201. The difference is whether there is one declaration
|
||||
block or not. To avoid this error, you have to give them one name each.
|
||||
"##,
|
||||
|
||||
E0599: r##"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue