From: Arthur Cohen Date: Wed, 2 Aug 2023 10:53:20 +0000 (+0200) Subject: gccrs: nr2.0: Add macros 2.0 in Ribs in TopLevel visitor X-Git-Tag: basepoints/gcc-15~2247 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ea51b5c81fd4ff602eff4ab0e526699b87dde8c;p=thirdparty%2Fgcc.git gccrs: 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. --- 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 2c0e0779acd9..c28d92270037 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 ¯o) { // 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 ¯o) 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