aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2024-03-26 15:58:48 -0400
committerArthur Cohen <arthur.cohen@embecosm.com>2024-08-01 16:52:29 +0200
commitd3acfa7c7e4a7d09be17dfdfd4fb5e60b623667f (patch)
tree77639a98a1dd87575588bc7700e7a5336da70552 /gcc/rust/parse
parent90ce6ea184f1b94e1bd1c88d4f99a9e055de3d97 (diff)
downloadgcc-d3acfa7c7e4a7d09be17dfdfd4fb5e60b623667f.zip
gcc-d3acfa7c7e4a7d09be17dfdfd4fb5e60b623667f.tar.gz
gcc-d3acfa7c7e4a7d09be17dfdfd4fb5e60b623667f.tar.bz2
gccrs: Avoid parsing const unsafe/extern functions as async
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_vis_item): Call parse_function instead of parse_async_item when finding UNSAFE or EXTERN_KW during lookahead. gcc/testsuite/ChangeLog: * rust/compile/func-const-unsafe.rs: New test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/parse')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index b6c2ca3..263ca63 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -1382,10 +1382,10 @@ Parser<ManagedTokenSource>::parse_vis_item (AST::AttrVec outer_attrs)
case IDENTIFIER:
case UNDERSCORE:
return parse_const_item (std::move (vis), std::move (outer_attrs));
- case UNSAFE:
- case EXTERN_KW:
case ASYNC:
return parse_async_item (std::move (vis), std::move (outer_attrs));
+ case UNSAFE:
+ case EXTERN_KW:
case FN_KW:
return parse_function (std::move (vis), std::move (outer_attrs));
default: