File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -3797,22 +3797,34 @@ E0592: r##"
3797
3797
This error occurs when you defined methods or associated functions with same
3798
3798
name.
3799
3799
3800
- For example, in the following code:
3800
+ Erroneous code example :
3801
3801
3802
3802
```compile_fail,E0592
3803
3803
struct Foo;
3804
3804
3805
3805
impl Foo {
3806
- fn bar() {}
3806
+ fn bar() {} // previous definition here
3807
3807
}
3808
3808
3809
3809
impl Foo {
3810
- fn bar() {}
3810
+ fn bar() {} // duplicate definition here
3811
3811
}
3812
3812
```
3813
3813
3814
3814
A similar error is E0201. The difference is whether there is one declaration
3815
3815
block or not. To avoid this error, you have to give them one name each.
3816
+
3817
+ ```
3818
+ struct Foo;
3819
+
3820
+ impl Foo {
3821
+ fn bar() {}
3822
+ }
3823
+
3824
+ impl Foo {
3825
+ fn baz() {} // define with different name
3826
+ }
3827
+ ```
3816
3828
"## ,
3817
3829
3818
3830
E0599 : r##"
You can’t perform that action at this time.
0 commit comments