aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorThomas Young <wenzhang5800@gmail.com>2021-05-21 14:45:32 +0800
committerThomas Young <wenzhang5800@gmail.com>2021-05-21 17:59:48 +0800
commit41fbeec90c31a0e13e2884b63633919f73e10a08 (patch)
treece5aa93f5be8ed4c92af2cc15b035de4aa174c46 /gcc/rust
parent937352288b3ef8d54ff3edc1ef7153369b564d36 (diff)
downloadgcc-41fbeec90c31a0e13e2884b63633919f73e10a08.zip
gcc-41fbeec90c31a0e13e2884b63633919f73e10a08.tar.gz
gcc-41fbeec90c31a0e13e2884b63633919f73e10a08.tar.bz2
only parse inner_attributes if it start with #! not only #
Fixed #419
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 5dcb458..dc8c773 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -442,7 +442,9 @@ Parser<ManagedTokenSource>::parse_inner_attributes ()
{
std::vector<AST::Attribute> inner_attributes;
- while (lexer.peek_token ()->get_id () == HASH)
+ // only try to parse it if it starts with "#!" not only "#"
+ while (lexer.peek_token ()->get_id () == HASH
+ && lexer.peek_token (1)->get_id () == EXCLAM)
{
AST::Attribute inner_attr = parse_inner_attribute ();