aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorMuhammad Mahad <mahadtxt@gmail.com>2023-08-17 10:42:52 +0500
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2023-09-04 08:31:39 +0000
commite5b5938b5ace4d6805cc364bdf7414fb6d1dc83a (patch)
tree64a896aa3f38f830cca2914190c568226b5cc1c1 /gcc/rust
parent699f5257192ce8d9a856f4ee2779887aae6e92e9 (diff)
downloadgcc-e5b5938b5ace4d6805cc364bdf7414fb6d1dc83a.zip
gcc-e5b5938b5ace4d6805cc364bdf7414fb6d1dc83a.tar.gz
gcc-e5b5938b5ace4d6805cc364bdf7414fb6d1dc83a.tar.bz2
gccrs:[E0592] methods or associated functions with same name already 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>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h5
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-expr.cc3
2 files changed, 5 insertions, 3 deletions
diff --git a/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h b/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h
index b0116e5..2641ecf 100644
--- a/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h
+++ b/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h
@@ -129,8 +129,11 @@ public:
const std::string &name)
{
rich_location r (line_table, dup->get_locus ());
+ std::string msg = "duplicate definitions for " + name;
+ r.add_fixit_replace (query->get_locus (), msg.c_str ());
r.add_range (query->get_locus ());
- rust_error_at (r, "duplicate definitions with name %s", name.c_str ());
+ rust_error_at (r, ErrorCode::E0592, "duplicate definitions with name %qs",
+ name.c_str ());
}
private:
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index 7d86abb..a05d0fd 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -1097,8 +1097,7 @@ TypeCheckExpr::visit (HIR::MethodCallExpr &expr)
r.add_fixit_replace (rich_msg.c_str ());
rust_error_at (
- r, ErrorCode::E0034,
- "multiple applicable items in scope for method %qs",
+ r, ErrorCode::E0592, "duplicate definitions with name %qs",
expr.get_method_name ().get_segment ().as_string ().c_str ());
return;
}