ast: Check before visiting a while-let's label#3797
Conversation
|
Looks like we're missing binding context handling for the https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-pattern-loops |
5f6dbd3 to
03ab681
Compare
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.
gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): New visitor. * resolve/rust-late-name-resolver-2.0.h: Declare it. * resolve/rust-name-resolution-context.h (enum class): New binding context.
I added a commit to handle while-let loops in NR2.0 in this PR, since we don't have the exclude file anymore - but I can split it in two PRs if you'd like @powerboat9. regarding the vector of patterns vs alt-pattern - I'm not sure. this is how it's done in the base loop expression, but I think it could be changed to just one optional pattern (as loop loops don't have them) |
03ab681 to
988329a
Compare
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: