https://gcc.gnu.org/g:1596bbb2823a07e5c12b1fbcb1fc3aaf1ecc471b

commit 1596bbb2823a07e5c12b1fbcb1fc3aaf1ecc471b
Author: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>
Date:   Thu Nov 9 15:30:32 2023 +0100

    Change error location for LoopLabel
    
    Loop label error reporting during ast validation was done at loop label
    level. It lead to some innacurate error reporting in break loop labels
    due to the way the label is built.
    
    gcc/rust/ChangeLog:
    
            * checks/errors/rust-ast-validation.cc (ASTValidation::visit): 
Change
            reported error location to the lifetime location.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>

Diff:
---
 gcc/rust/checks/errors/rust-ast-validation.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc 
b/gcc/rust/checks/errors/rust-ast-validation.cc
index 44dec61b921b..0ba73c674150 100644
--- a/gcc/rust/checks/errors/rust-ast-validation.cc
+++ b/gcc/rust/checks/errors/rust-ast-validation.cc
@@ -43,7 +43,7 @@ ASTValidation::visit (AST::LoopLabel &label)
   auto lifetime_name = '\'' + name;
   auto &keywords = Values::Keywords::keywords;
   if (keywords.find (name) != keywords.end ())
-    rust_error_at (label.get_locus (), "invalid label name %qs",
+    rust_error_at (label.get_lifetime ().get_locus (), "invalid label name 
%qs",
                   lifetime_name.c_str ());
 
   // WARNING: Do not call ContextualASTVisitor, we don't want to visit the

Reply via email to