Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E0592] method or associated functions already defined with same names #2555

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

MahadMuhammad
Copy link
Contributor

Multiple candidated for method or function - E0592

  • Added errorcode & rich location.

Running testcases:

Output:

../mahad-testsuite/E0592.rs:28:7: error: duplicate definitions with name ‘bar’ [E0592]
    9 |     fn bar(self) -> isize {
      |     ~~ 
      |     duplicate definitions for bar
......
   21 |     fn bar(self) -> T {
      |     ~~ 
      |     duplicate definitions for bar
......
   28 |     a.bar();
      |       ^~~

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Added rich location and errorcode.

gcc/testsuite/ChangeLog:

* rust/compile/generics7.rs: Updated comment.
* rust/compile/issue-925.rs: likewise.


rust_error_at (
r, "multiple candidates found for method %<%s%>",
r, ErrorCode::E0592, "duplicate definitions with name %<%s%>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, not sure which message we should keep here and which error code we should use

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the original error message, as this one could confuse the user since the error will appear on the use site rather than the definition site

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

@MahadMuhammad MahadMuhammad changed the title [E0592] Duplicate def of method or associated functions [E0592] method or associated functions already defined with same names Aug 17, 2023
@philberty
Copy link
Member

@MahadMuhammad this has merge conflicts can you fix it up?

@philberty philberty added the diagnostic diagnostic static analysis label Aug 28, 2023
@philberty philberty added this to the GCC 14 Stage 3 milestone Aug 28, 2023
@MahadMuhammad
Copy link
Contributor Author

@philberty, Sure thing. I'll do it :)

@CohenArthur
Copy link
Member

@MahadMuhammad the tests are failing, once this is fixed I'll merge this

@P-E-P P-E-P added this pull request to the merge queue Sep 1, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Sep 1, 2023
…defined

gcc/rust/ChangeLog:

	* typecheck/rust-hir-inherent-impl-overlap.h:
	Added rich location and errorcode.
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
	likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/generics7.rs: Added Errorcode hint.
	* rust/compile/generics8.rs: Updated dejagnu comment.
	* rust/compile/issue-925.rs: Added Errorcode hint.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
@P-E-P P-E-P added this pull request to the merge queue Sep 4, 2023
Merged via the queue into Rust-GCC:master with commit e5b5938 Sep 4, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants