aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-08-02 12:53:20 +0200
committerCohenArthur <arthur.cohen@embecosm.com>2023-08-03 17:36:42 +0000
commit88d258483f929a7e3e79d1ea61e0684e5a616811 (patch)
tree788a0687e91c415a6233d78897939b273300e5b8 /gcc/rust
parent6993fe43fcd990305c91ca8a2f98ce9eac0a3073 (diff)
downloadgcc-88d258483f929a7e3e79d1ea61e0684e5a616811.zip
gcc-88d258483f929a7e3e79d1ea61e0684e5a616811.tar.gz
gcc-88d258483f929a7e3e79d1ea61e0684e5a616811.tar.bz2
nr2.0: Add macros 2.0 in Ribs in TopLevel visitor
gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Declare macros in the current rib if they are macros 2.0.
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
index 2c0e077..c28d922 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -86,7 +86,8 @@ TopLevel::visit (AST::MacroRulesDefinition &macro)
{
// we do not insert macros in the current rib as that needs to be done in the
// textual scope of the Early pass. we only insert them in the root of the
- // crate if they are marked with #[macro_export]
+ // crate if they are marked with #[macro_export]. The execption to this is
+ // macros 2.0, which get resolved and inserted like regular items.
if (is_macro_export (macro))
{
@@ -103,6 +104,9 @@ TopLevel::visit (AST::MacroRulesDefinition &macro)
macro.get_rule_name ().as_string ().c_str ());
}
}
+
+ if (macro.get_kind () == AST::MacroRulesDefinition::MacroKind::DeclMacro)
+ insert_or_error_out (macro.get_rule_name (), macro, Namespace::Macros);
}
void