public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Avoid parsing const unsafe/extern functions as async
@ 2024-05-07 16:29 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2024-05-07 16:29 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:01092b83913733d26f2c4d9bfdc22ff2eb0b0bbb
commit 01092b83913733d26f2c4d9bfdc22ff2eb0b0bbb
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date: Tue Mar 26 15:58:48 2024 -0400
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>
Diff:
---
gcc/rust/parse/rust-parse-impl.h | 4 ++--
gcc/testsuite/rust/compile/func-const-unsafe.rs | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index b6c2ca3fc0c9..263ca634ea5c 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:
diff --git a/gcc/testsuite/rust/compile/func-const-unsafe.rs b/gcc/testsuite/rust/compile/func-const-unsafe.rs
new file mode 100644
index 000000000000..9c932bd1cb54
--- /dev/null
+++ b/gcc/testsuite/rust/compile/func-const-unsafe.rs
@@ -0,0 +1 @@
+pub const unsafe fn foo() {}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-07 16:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 16:29 [gcc/devel/rust/master] Avoid parsing const unsafe/extern functions as async 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).