diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-07-18 16:00:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 16:00:54 +0000 |
commit | 6622ae2cd0a6b69b84a33f61ae7707c02caa88b9 (patch) | |
tree | cf3e249b28ac3a3c6c7d350ec278755df211dee0 /gcc/rust | |
parent | 265d5e86f26d6dff9a795dace55243ac7de12134 (diff) | |
parent | 3bf3ea88786c43f81064f913d62115a48aac9f44 (diff) | |
download | gcc-6622ae2cd0a6b69b84a33f61ae7707c02caa88b9.zip gcc-6622ae2cd0a6b69b84a33f61ae7707c02caa88b9.tar.gz gcc-6622ae2cd0a6b69b84a33f61ae7707c02caa88b9.tar.bz2 |
Merge #1392
1392: Ensure we parse any inner item attributes when expanding a module r=philberty a=philberty
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
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/ast/rust-ast-full-test.cc | 2 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 2 |
2 files changed, 3 insertions, 1 deletions
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<Lexer> 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 (); diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 4cae6ff..e4c5a2c 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -149,6 +149,7 @@ public: std::unique_ptr<AST::IdentifierPattern> parse_identifier_pattern (); std::unique_ptr<AST::TokenTree> parse_token_tree (); AST::Attribute parse_attribute_body (); + AST::AttrVec parse_inner_attributes (); private: void skip_after_semicolon (); @@ -164,7 +165,6 @@ private: void parse_statement_seq (bool (Parser::*done) ()); // AST-related stuff - maybe move or something? - AST::AttrVec parse_inner_attributes (); AST::Attribute parse_inner_attribute (); AST::AttrVec parse_outer_attributes (); AST::Attribute parse_outer_attribute (); |