diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-02-17 00:56:07 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2021-02-18 13:07:49 +0300 |
| commit | 4a8816512477513f57986685738cd065e72c4908 (patch) | |
| tree | 264d04ccc27f50e8b7f3e91402ba228e97af43c6 /compiler/rustc_parse/src/parser | |
| parent | eb65f15c7800930c3f74288974689d9884e51ba0 (diff) | |
| download | rust-4a8816512477513f57986685738cd065e72c4908.tar.gz rust-4a8816512477513f57986685738cd065e72c4908.zip | |
ast: Keep expansion status for out-of-line module items
Also remove `ast::Mod` which is mostly redundant now
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index c0464c3edbc..0f907859a19 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -35,14 +35,16 @@ impl<'a> Parser<'a> { let unsafety = self.parse_unsafety(); self.expect_keyword(kw::Mod)?; let id = self.parse_ident()?; - let ((mut inner_attrs, items, inner), inline) = if self.eat(&token::Semi) { - ((Vec::new(), Vec::new(), Span::default()), false) + let mod_kind = if self.eat(&token::Semi) { + ModKind::Unloaded } else { self.expect(&token::OpenDelim(token::Brace))?; - (self.parse_mod(&token::CloseDelim(token::Brace))?, true) + let (mut inner_attrs, items, inner_span) = + self.parse_mod(&token::CloseDelim(token::Brace))?; + attrs.append(&mut inner_attrs); + ModKind::Loaded(items, Inline::Yes, inner_span) }; - attrs.append(&mut inner_attrs); - Ok((id, ItemKind::Mod(Mod { unsafety, inline, items, inner }))) + Ok((id, ItemKind::Mod(unsafety, mod_kind))) } /// Parses the contents of a module (inner attributes followed by module items). |
