From 3bf3ea88786c43f81064f913d62115a48aac9f44 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 18 Jul 2022 16:16:12 +0100 Subject: Ensure we parse any inner item attributes when expanding a module When compiling code containing module expansions we must first ensure any possible inner item attributes are parser first and applied to the module, otherwise we end up in a bad state and ignore attributes. Fixes #1089 --- gcc/rust/ast/rust-ast-full-test.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/rust/ast') diff --git a/gcc/rust/ast/rust-ast-full-test.cc b/gcc/rust/ast/rust-ast-full-test.cc index 25ec6db..cac816d 100644 --- a/gcc/rust/ast/rust-ast-full-test.cc +++ b/gcc/rust/ast/rust-ast-full-test.cc @@ -4056,6 +4056,8 @@ Module::load_items () Lexer lex (module_file.c_str (), std::move (file_wrap), linemap); Parser parser (lex); + // we need to parse any possible inner attributes for this module + inner_attrs = parser.parse_inner_attributes (); auto parsed_items = parser.parse_items (); for (const auto &error : parser.get_errors ()) error.emit_error (); -- cgit v1.1