aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorMarc Poulhiès <dkm@kataplop.net>2021-03-23 22:03:55 +0100
committerPhilip Herron <herron.philip@googlemail.com>2021-03-27 18:07:49 +0000
commite77c44ef26fdf7e66fd7129a3aa9240840344694 (patch)
treee6f551284851657d57967a7d1583c058d8047780 /gcc/rust
parentfabb3894d5fe5c2ca87917fd08b2f0813553532d (diff)
downloadgcc-e77c44ef26fdf7e66fd7129a3aa9240840344694.zip
gcc-e77c44ef26fdf7e66fd7129a3aa9240840344694.tar.gz
gcc-e77c44ef26fdf7e66fd7129a3aa9240840344694.tar.bz2
Fix error while unexpected EOF when scanning for end of comment
Emit an error when EOF is reached before end of C-style comment. Add corresponding test for non regression. fix #300
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/lex/rust-lex.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc
index 6dfaea2..26745e4 100644
--- a/gcc/rust/lex/rust-lex.cc
+++ b/gcc/rust/lex/rust-lex.cc
@@ -427,6 +427,14 @@ Lexer::build_token ()
current_column++; // for error-handling
current_char = peek_input ();
+ if (current_char == EOF)
+ {
+ rust_error_at (
+ loc, "unexpected EOF while looking for end of comment",
+ current_char);
+ break;
+ }
+
// if /* found
if (current_char == '/' && peek_input (1) == '*')
{