]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Change error location for LoopLabel
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Thu, 9 Nov 2023 14:30:32 +0000 (15:30 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:13:14 +0000 (19:13 +0100)
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.patry@embecosm.com>
gcc/rust/checks/errors/rust-ast-validation.cc

index 44dec61b921b9407202d2e23cfaabc4f082ce09a..0ba73c674150bb3a9ab15c715da683ec40ee4195 100644 (file)
@@ -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