public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Fix infinite loop with parsing invalid generic parameters
@ 2023-05-02 7:12 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-05-02 7:12 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:fef6c560017c33a4d5e439067bad09a85630f851
commit fef6c560017c33a4d5e439067bad09a85630f851
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date: Tue Apr 18 00:46:59 2023 -0400
Fix infinite loop with parsing invalid generic parameters
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h
(Parser::parse_generic_params):
Handle parameter parsing error.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2125.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diff:
---
gcc/rust/parse/rust-parse-impl.h | 2 ++
gcc/testsuite/rust/compile/issue-2125.rs | 2 ++
2 files changed, 4 insertions(+)
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 2609e5ae94b..1bb3a9a356e 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -3127,6 +3127,8 @@ Parser<ManagedTokenSource>::parse_generic_params (EndTokenPred is_end_token)
generic_params.emplace_back (std::move (param));
maybe_skip_token (COMMA);
}
+ else
+ break;
}
// FIXME: Add reordering hint
diff --git a/gcc/testsuite/rust/compile/issue-2125.rs b/gcc/testsuite/rust/compile/issue-2125.rs
new file mode 100644
index 00000000000..cbcf4cb133f
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-2125.rs
@@ -0,0 +1,2 @@
+// { dg-timeout 5 }
+struct S<$>; // { dg-error ".*" }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-02 7:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-02 7:12 [gcc/devel/rust/master] Fix infinite loop with parsing invalid generic parameters Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).