diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index b6c2ca3fc0c..263ca634ea5 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 00000000000..9c932bd1cb5 --- /dev/null +++ b/gcc/testsuite/rust/compile/func-const-unsafe.rs @@ -0,0 +1 @@ +pub const unsafe fn foo() {}