aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2025-04-01 12:02:31 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2025-04-08 10:17:17 +0200
commitd7bbb929a884bd429bc4b43d9fed57d57ab285b4 (patch)
tree4da6da8f5801bf23a009122dcf1427aef43985ea
parentd85a88aa3fdf2a5d66288d5809da864b956cc8d4 (diff)
downloadgcc-d7bbb929a884bd429bc4b43d9fed57d57ab285b4.zip
gcc-d7bbb929a884bd429bc4b43d9fed57d57ab285b4.tar.gz
gcc-d7bbb929a884bd429bc4b43d9fed57d57ab285b4.tar.bz2
gccrs: Visit loop label before predicate expression
If the label is referenced within the while predicate expression it has to be resolved before the latter. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change default visit order. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove test from exclusion list. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r--gcc/rust/ast/rust-ast-visitor.cc2
-rw-r--r--gcc/testsuite/rust/compile/nr2/exclude2
2 files changed, 1 insertions, 3 deletions
diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc
index 6a81fa1..73c6b1e 100644
--- a/gcc/rust/ast/rust-ast-visitor.cc
+++ b/gcc/rust/ast/rust-ast-visitor.cc
@@ -567,9 +567,9 @@ void
DefaultASTVisitor::visit (AST::WhileLoopExpr &expr)
{
visit_outer_attrs (expr);
- visit (expr.get_predicate_expr ());
if (expr.has_loop_label ())
visit (expr.get_loop_label ());
+ visit (expr.get_predicate_expr ());
visit (expr.get_loop_block ());
}
diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude
index 2f4585c..c688026 100644
--- a/gcc/testsuite/rust/compile/nr2/exclude
+++ b/gcc/testsuite/rust/compile/nr2/exclude
@@ -14,9 +14,7 @@ pub_restricted_2.rs
pub_restricted_3.rs
undeclared_label.rs
use_1.rs
-while_break_expr.rs
issue-2905-2.rs
-issue-266.rs
derive_clone_enum3.rs
derive-debug1.rs
derive-default1.rs