Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parse mut ref #2678

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gcc/rust/parse/rust-parse-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12082,7 +12082,7 @@ Parser<ManagedTokenSource>::parse_expr (int right_binding_power,
{
TokenId id = current_token->get_id ();
if (id == SEMICOLON || id == RIGHT_PAREN || id == RIGHT_CURLY
|| id == RIGHT_SQUARE)
|| id == RIGHT_SQUARE || id == COMMA)
return nullptr;
}

Expand Down
14 changes: 14 additions & 0 deletions gcc/testsuite/rust/compile/match_break.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// { dg-additional-options "-frust-compile-until=ast" }
enum Nat {
S(Box<Nat>),
Z,
}
fn test(x: &mut Nat) {
let mut p = &mut *x;
loop {
match p {
&mut Nat::Z => break,
&mut Nat::S(ref mut n) => p = &mut *n,
}
}
}