Skip to content

Commit 01092b8

Browse files
powerboat9P-E-P
authored andcommitted
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>
1 parent fd621e1 commit 01092b8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

gcc/rust/parse/rust-parse-impl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1382,10 +1382,10 @@ Parser<ManagedTokenSource>::parse_vis_item (AST::AttrVec outer_attrs)
13821382
case IDENTIFIER:
13831383
case UNDERSCORE:
13841384
return parse_const_item (std::move (vis), std::move (outer_attrs));
1385-
case UNSAFE:
1386-
case EXTERN_KW:
13871385
case ASYNC:
13881386
return parse_async_item (std::move (vis), std::move (outer_attrs));
1387+
case UNSAFE:
1388+
case EXTERN_KW:
13891389
case FN_KW:
13901390
return parse_function (std::move (vis), std::move (outer_attrs));
13911391
default:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub const unsafe fn foo() {}

0 commit comments

Comments
 (0)