[034/125] gccrs: Add error emitting when we can't resolve id expr

Message ID 20240801145809.366388-36-arthur.cohen@embecosm.com
State Committed
Commit 399645909b86db885fbd491d3b75007dc110b6b3
Headers
Series [001/125] Rust: Make 'tree'-level 'MAIN_NAME_P' work |

Commit Message

Arthur Cohen Aug. 1, 2024, 2:56 p.m. UTC
  From: jjasmine <tanghocle456@gmail.com>

gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
---
 gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
index f9731a451a3..8717c51e34a 100644
--- a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc
@@ -130,7 +130,10 @@  Late::visit (AST::IdentifierExpr &expr)
     resolved = label;
   else if (value)
     resolved = value;
-  // TODO: else emit error?
+  else {
+      rust_error_at(expr.get_locus (), "could not resolve identifier expression: %qs", expr.get_ident ().as_string ().c_str ());
+      return;
+  }
 
   ctx.map_usage (expr.get_node_id (), *resolved);