diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2025-02-18 21:20:45 -0500 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2025-02-25 12:23:55 +0000 |
commit | e4ebd02d4528ac3fbfc70ee1abcd95fcbd44d66e (patch) | |
tree | 08dc06d4bf62e017bdb747adb812f5b72a4646a1 /gcc/rust/resolve | |
parent | 2ba365c3726765fec8249464a4e78864c240b31e (diff) | |
download | gcc-e4ebd02d4528ac3fbfc70ee1abcd95fcbd44d66e.zip gcc-e4ebd02d4528ac3fbfc70ee1abcd95fcbd44d66e.tar.gz gcc-e4ebd02d4528ac3fbfc70ee1abcd95fcbd44d66e.tar.bz2 |
nr2.0: Implement macro_use for modules
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc:
Include rust-attribute-values.h.
(Early::visit): If a module has a macro_use attribute, avoid
pushing a new textual macro scope.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r-- | gcc/rust/resolve/rust-early-name-resolver-2.0.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc index cdd8d16..319bc1d 100644 --- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc @@ -22,6 +22,7 @@ #include "rust-toplevel-name-resolver-2.0.h" #include "rust-attributes.h" #include "rust-finalize-imports-2.0.h" +#include "rust-attribute-values.h" namespace Rust { namespace Resolver2_0 { @@ -227,11 +228,24 @@ Early::visit (AST::BlockExpr &block) void Early::visit (AST::Module &module) { - textual_scope.push (); + bool is_macro_use = false; + + for (const auto &attr : module.get_outer_attrs ()) + { + if (attr.get_path ().as_string () == Values::Attributes::MACRO_USE) + { + is_macro_use = true; + break; + } + } + + if (!is_macro_use) + textual_scope.push (); DefaultResolver::visit (module); - textual_scope.pop (); + if (!is_macro_use) + textual_scope.pop (); } void |