public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8003] gccrs: [E0599] Failed to resovle method implementation Date: Tue, 16 Jan 2024 18:12:38 +0000 (GMT) [thread overview] Message-ID: <20240116181238.9C2823858C42@sourceware.org> (raw) 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 } }
reply other threads:[~2024-01-16 18:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240116181238.9C2823858C42@sourceware.org \ --to=cohenarthur@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).