public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8003] gccrs: [E0599] Failed to resovle method implementation
@ 2024-01-16 18:12 Arthur Cohen
0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:12 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2b560b964d60e42ea4cc99118b786acb0d96db34
commit r14-8003-g2b560b964d60e42ea4cc99118b786acb0d96db34
Author: Muhammad Mahad <mahadtxt@gmail.com>
Date: Tue Aug 29 20:00:18 2023 +0500
gccrs: [E0599] Failed to resovle method implementation
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Added new error message, rich location and error code.
gcc/testsuite/ChangeLog:
* rust/compile/cfg2.rs: Updated according to new message.
* rust/compile/issue-2139.rs: likewise.
* rust/compile/issue-2190-1.rs: likewise.
* rust/compile/method1.rs: likewise.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Diff:
---
gcc/rust/typecheck/rust-hir-type-check-expr.cc | 6 ++++--
gcc/testsuite/rust/compile/cfg2.rs | 2 +-
gcc/testsuite/rust/compile/issue-2139.rs | 2 +-
gcc/testsuite/rust/compile/issue-2190-1.rs | 2 +-
gcc/testsuite/rust/compile/method1.rs | 2 +-
5 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index f0911967470..4ed84840e88 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -1077,9 +1077,11 @@ TypeCheckExpr::visit (HIR::MethodCallExpr &expr)
expr.get_method_name ().get_segment ());
if (candidates.empty ())
{
+ rich_location richloc (line_table, expr.get_method_name ().get_locus ());
+ richloc.add_fixit_replace ("method not found");
rust_error_at (
- expr.get_method_name ().get_locus (),
- "failed to resolve method for %<%s%>",
+ richloc, ErrorCode::E0599,
+ "no method named %qs found in the current scope",
expr.get_method_name ().get_segment ().as_string ().c_str ());
return;
}
diff --git a/gcc/testsuite/rust/compile/cfg2.rs b/gcc/testsuite/rust/compile/cfg2.rs
index e4c90d96dd4..ce1c5f96369 100644
--- a/gcc/testsuite/rust/compile/cfg2.rs
+++ b/gcc/testsuite/rust/compile/cfg2.rs
@@ -8,5 +8,5 @@ impl Foo {
fn main() {
let a = Foo;
a.test();
- // { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .test. found in the current scope" "" { target *-*-* } .-1 }
}
diff --git a/gcc/testsuite/rust/compile/issue-2139.rs b/gcc/testsuite/rust/compile/issue-2139.rs
index 3b9ad954679..65f82f39f40 100644
--- a/gcc/testsuite/rust/compile/issue-2139.rs
+++ b/gcc/testsuite/rust/compile/issue-2139.rs
@@ -14,5 +14,5 @@ impl Foo for u16 {
fn main() {
let a: u16 = 123;
a.foo();
- // { dg-error "failed to resolve method for .foo." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .foo. found in the current scope" "" { target *-*-* } .-1 }
}
diff --git a/gcc/testsuite/rust/compile/issue-2190-1.rs b/gcc/testsuite/rust/compile/issue-2190-1.rs
index 057d7c71633..927f90d6c9b 100644
--- a/gcc/testsuite/rust/compile/issue-2190-1.rs
+++ b/gcc/testsuite/rust/compile/issue-2190-1.rs
@@ -9,5 +9,5 @@ trait Deref {
fn foo<T: Deref<Target = i32>>(t: &T) -> i32 {
t.max(2)
- // { dg-error "failed to resolve method for .max." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .max. found in the current scope" "" { target *-*-* } .-1 }
}
diff --git a/gcc/testsuite/rust/compile/method1.rs b/gcc/testsuite/rust/compile/method1.rs
index d371bf271f8..3741c61b076 100644
--- a/gcc/testsuite/rust/compile/method1.rs
+++ b/gcc/testsuite/rust/compile/method1.rs
@@ -8,5 +8,5 @@ pub fn main() {
a = Foo(123);
a.test();
- // { dg-error "failed to resolve method for .test." "" { target *-*-* } .-1 }
+ // { dg-error "no method named .test. found in the current scope" "" { target *-*-* } .-1 }
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-16 18:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:12 [gcc r14-8003] gccrs: [E0599] Failed to resovle method implementation Arthur Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).