Skip to content

Commit

Permalink
Auto merge of #61822 - JohnTitor:add-long-e0592, r=GuillaumeGomez,Cen…
Browse files Browse the repository at this point in the history
…tril

Add explanation for E0592

This is a part of #61137

r? @GuillaumeGomez
  • Loading branch information
bors committed Jun 18, 2019
2 parents a6a8f6c + 3d5ef11 commit 0376941
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 2 deletions.
35 changes: 34 additions & 1 deletion src/librustc_typeck/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3793,6 +3793,40 @@ details.
[issue #33685]: https://github.com/rust-lang/rust/issues/33685
"##,

E0592: r##"
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
}
```
"##,

E0599: r##"
This error occurs when a method is used on a type which doesn't implement it:
Expand Down Expand Up @@ -4771,7 +4805,6 @@ register_diagnostics! {
// but `{}` was found in the type `{}`
E0587, // type has conflicting packed and align representation hints
E0588, // packed type cannot transitively contain a `[repr(align)]` type
E0592, // duplicate definitions with name `{}`
// E0611, // merged into E0616
// E0612, // merged into E0609
// E0613, // Removed (merged with E0609)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | impl dyn C { fn f() {} }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0592`.
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ LL | fn baz(&self) {}

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0592`.
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ LL | impl<X> A<i32, X> { fn f(&self) {} }

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0592`.
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ LL | impl<X> A<i32, X> { fn f(&self) {} }

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0592`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0592`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | impl<U:Sugar> Cake<Box<U>> { fn dummy(&self) { } }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0592`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | impl A<i16> { fn dummy(&self) { } }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0592`.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ LL | impl A<i16> { fn dummy(&self) { } }

error: aborting due to previous error

For more information about this error, try `rustc --explain E0592`.
3 changes: 2 additions & 1 deletion src/test/ui/issues/issue-33140.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ LL | | }

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0119`.
Some errors have detailed explanations: E0119, E0592.
For more information about an error, try `rustc --explain E0119`.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | fn f() {}

error: aborting due to previous error

For more information about this error, try `rustc --explain E0592`.
1 change: 1 addition & 0 deletions src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | fn test(&self) { println!("two"); }

error: aborting due to previous error

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

0 comments on commit 0376941

Please sign in to comment.