Skip to content

Commit 047f9bc

Browse files
committed
Add explanation for E0592
1 parent 05083c2 commit 047f9bc

12 files changed

+34
-2
lines changed

src/librustc_typeck/error_codes.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -3793,6 +3793,28 @@ details.
37933793
[issue #33685]: https://github.com/rust-lang/rust/issues/33685
37943794
"##,
37953795

3796+
E0592: r##"
3797+
This error occurs when you defined methods or associated functions with same
3798+
name.
3799+
3800+
For example, in the following code:
3801+
3802+
```compile_fail,E0592
3803+
struct Foo;
3804+
3805+
impl Foo {
3806+
fn bar() {}
3807+
}
3808+
3809+
impl Foo {
3810+
fn bar() {}
3811+
}
3812+
```
3813+
3814+
A similar error is E0201. The difference is whether there is one declaration
3815+
block or not. To avoid this error, you have to give them one name each.
3816+
"##,
3817+
37963818
E0599: r##"
37973819
This error occurs when a method is used on a type which doesn't implement it:
37983820
@@ -4771,7 +4793,6 @@ register_diagnostics! {
47714793
// but `{}` was found in the type `{}`
47724794
E0587, // type has conflicting packed and align representation hints
47734795
E0588, // packed type cannot transitively contain a `[repr(align)]` type
4774-
E0592, // duplicate definitions with name `{}`
47754796
// E0611, // merged into E0616
47764797
// E0612, // merged into E0609
47774798
// E0613, // Removed (merged with E0609)

src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ LL | impl dyn C { fn f() {} }
88

99
error: aborting due to previous error
1010

11+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/codemap_tests/overlapping_inherent_impls.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ LL | fn baz(&self) {}
2929

3030
error: aborting due to 3 previous errors
3131

32+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/coherence/coherence-overlap-downstream-inherent.old.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ LL | impl<X> A<i32, X> { fn f(&self) {} }
2020

2121
error: aborting due to 2 previous errors
2222

23+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ LL | impl<X> A<i32, X> { fn f(&self) {} }
2020

2121
error: aborting due to 2 previous errors
2222

23+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/coherence/coherence-overlap-upstream-inherent.old.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | impl A<i16> { fn dummy(&self) { } }
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | impl A<i16> { fn dummy(&self) { } }
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/issues/issue-33140.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ LL | | }
3131

3232
error: aborting due to 3 previous errors
3333

34-
For more information about this error, try `rustc --explain E0119`.
34+
Some errors have detailed explanations: E0119, E0592.
35+
For more information about an error, try `rustc --explain E0119`.

src/test/ui/specialization/specialization-overlap-hygiene.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ LL | fn f() {}
99

1010
error: aborting due to previous error
1111

12+
For more information about this error, try `rustc --explain E0592`.

src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ LL | fn test(&self) { println!("two"); }
99

1010
error: aborting due to previous error
1111

12+
For more information about this error, try `rustc --explain E0592`.

0 commit comments

Comments
 (0)