aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-03-17 10:22:44 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2022-03-17 10:22:44 +0100
commitb776c4953ca125855f37e381ad51ae8ae836247c (patch)
tree0c647ecb8da046bd48fd981803ccf245dc2f73be /gcc/rust
parent14b99bed0801da460db998f8ec65f31e992f0e52 (diff)
downloadgcc-b776c4953ca125855f37e381ad51ae8ae836247c.zip
gcc-b776c4953ca125855f37e381ad51ae8ae836247c.tar.gz
gcc-b776c4953ca125855f37e381ad51ae8ae836247c.tar.bz2
macros: Do not lower macro definitions to HIR
Avoid lowering block statements that should not be lowered, such as macro-rules definitions
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/hir/rust-ast-lower.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower.cc b/gcc/rust/hir/rust-ast-lower.cc
index d9ce9aa..27f73e0 100644
--- a/gcc/rust/hir/rust-ast-lower.cc
+++ b/gcc/rust/hir/rust-ast-lower.cc
@@ -67,6 +67,9 @@ ASTLoweringBlock::visit (AST::BlockExpr &expr)
for (auto &s : expr.get_statements ())
{
+ if (s->get_ast_kind () == AST::Kind::MACRO_RULES_DEFINITION)
+ continue;
+
if (block_did_terminate)
rust_warning_at (s->get_locus (), 0, "unreachable statement");