From 139f6c3875304b48a22d9e4735ca74d045f8a332 Mon Sep 17 00:00:00 2001 From: Muhammad Mahad Date: Tue, 29 Aug 2023 20:00:18 +0500 Subject: 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 --- gcc/rust/typecheck/rust-hir-type-check-expr.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/rust') diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc index a05d0fd..805c4bb 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; } -- cgit v1.1