gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check that the WhileLet has a label
before visiting it.
gcc/testsuite/ChangeLog:
* rust/compile/while_let_without_label.rs: New test.
visit_outer_attrs (expr);
for (auto &pattern : expr.get_patterns ())
visit (pattern);
- visit (expr.get_loop_label ());
+
+ if (expr.has_loop_label ())
+ visit (expr.get_loop_label ());
+
visit (expr.get_scrutinee_expr ());
visit (expr.get_loop_block ());
}
--- /dev/null
+// { dg-additional-options "-frust-compile-until=lowering" }
+
+enum Foo {
+ A(i32),
+}
+
+fn main() {
+ let b = Foo::A(15);
+
+ while let Foo::A(x) = b {}
+}