aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-21 10:25:20 +0000
committerGitHub <noreply@github.com>2021-05-21 10:25:20 +0000
commit6e808c647e53bf3805c47a8ae699091c3a4919bf (patch)
treece5aa93f5be8ed4c92af2cc15b035de4aa174c46 /gcc/rust
parent937352288b3ef8d54ff3edc1ef7153369b564d36 (diff)
parent41fbeec90c31a0e13e2884b63633919f73e10a08 (diff)
downloadgcc-6e808c647e53bf3805c47a8ae699091c3a4919bf.zip
gcc-6e808c647e53bf3805c47a8ae699091c3a4919bf.tar.gz
gcc-6e808c647e53bf3805c47a8ae699091c3a4919bf.tar.bz2
Merge #436
436: Fixed #419: only parse inner_attributes if it starts with "#!" not only "#" r=philberty a=thomasyonug Fixed #419 only parse inner_attributes if it starts with "#!" not only "#" Co-authored-by: Thomas Young <wenzhang5800@gmail.com>
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 ();