diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-11-21 10:29:35 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-30 12:36:47 +0100 |
commit | 12844c82dec296c8530594211a65b55875797b43 (patch) | |
tree | f1125040ebbb72747663b77d9cdcb5f102eef9e3 /gcc/c | |
parent | f84e564243915e729f22a5b6e4d1e4fb902f94f9 (diff) | |
download | gcc-12844c82dec296c8530594211a65b55875797b43.zip gcc-12844c82dec296c8530594211a65b55875797b43.tar.gz gcc-12844c82dec296c8530594211a65b55875797b43.tar.bz2 |
gccrs: Split async and const function qualifiers
A function cannot be both async and const, however this should not be
handled in the parser but rather at a later stage in the compiler. This
commit change the AsyncConstStatus in the AST and the HIR to allows a
function to be both async and const.
gcc/rust/ChangeLog:
* ast/rust-ast-builder.cc (AstBuilder::fn_qualifiers): Change
constructor to match the new arguments.
* ast/rust-ast-collector.cc (TokenCollector::visit): Change behavior
to handle both const and async specifiers at the same time.
* ast/rust-ast.cc (FunctionQualifiers::as_string): Likewise.
* ast/rust-item.h (class FunctionQualifiers): Remove AsyncConstStatus
and replace it with both Async and Const status. Also change the safety
arguments to use an enum instead of a boolean.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers):
Update constructor call.
* hir/tree/rust-hir-item.h: Add Const and Async status, remove
AsyncConstStatus, update the constructor.
* hir/tree/rust-hir.cc (FunctionQualifiers::as_string): Update with
the new status.
* parse/rust-parse-impl.h (Parser::parse_function_qualifiers): Update
constructor call.
* util/rust-common.h (enum Mutability): Make an enum class.
(enum class): Add Async and Const enum class to avoid booleans.
(enum Unsafety): Change to an enum class.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions