diff mbox series

[080/125] gccrs: Change error message to match test

Message ID 20240801145809.366388-82-arthur.cohen@embecosm.com
State New
Headers show
Series [001/125] Rust: Make 'tree'-level 'MAIN_NAME_P' work | expand

Commit Message

Arthur Cohen Aug. 1, 2024, 2:57 p.m. UTC
From: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Error message did not match the test from the previous name resolver when
a given path cannot be resolved.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
	Change error message to match old resolver and test case.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
---
 gcc/rust/typecheck/rust-hir-type-check-path.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc
index cdb506dacbe..b0e52c454e9 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-path.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc
@@ -266,8 +266,10 @@  TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset,
 	{
 	  if (is_root)
 	    {
-	      rust_error_at (seg.get_locus (),
-			     "failed to resolve root segment");
+	      rust_error_at (expr.get_locus (), ErrorCode::E0425,
+			     "cannot find value %qs in this scope",
+			     expr.as_simple_path ().as_string ().c_str ());
+
 	      return new TyTy::ErrorType (expr.get_mappings ().get_hirid ());
 	    }
 	  return root_tyty;