Skip to content

Commit e252aae

Browse files
committed
Fix examples
1 parent 047f9bc commit e252aae

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/librustc_typeck/error_codes.rs

+15-3
Original file line numberDiff line numberDiff line change
@@ -3797,22 +3797,34 @@ E0592: r##"
37973797
This error occurs when you defined methods or associated functions with same
37983798
name.
37993799
3800-
For example, in the following code:
3800+
Erroneous code example:
38013801
38023802
```compile_fail,E0592
38033803
struct Foo;
38043804
38053805
impl Foo {
3806-
fn bar() {}
3806+
fn bar() {} // previous definition here
38073807
}
38083808
38093809
impl Foo {
3810-
fn bar() {}
3810+
fn bar() {} // duplicate definition here
38113811
}
38123812
```
38133813
38143814
A similar error is E0201. The difference is whether there is one declaration
38153815
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+
```
38163828
"##,
38173829

38183830
E0599: r##"

0 commit comments

Comments
 (0)