Rollup merge of #82238 - petrochenkov:nocratemod, r=Aaron1011

ast: Keep expansion status for out-of-line module items

I.e. whether a module `mod foo;` is already loaded from a file or not.
This is a pre-requisite to correctly treating inner attributes on such modules (https://github.com/rust-lang/rust/issues/81661).

With this change AST structures for `mod` items diverge even more for AST structure for the crate root, which previously used `ast::Mod`.
Therefore this PR removes `ast::Mod` from `ast::Crate` in the first commit, these two things are sufficiently different from each other, at least at syntactic level.
Customization points for visiting a "`mod` item or crate root" were also removed from AST visitors (`fn visit_mod`).
`ast::Mod` itself was refactored away in the second commit in favor of `ItemKind::Mod(Unsafe, ModKind)`.
This commit is contained in:
Dylan DPC 2021-02-19 02:49:08 +01:00 committed by GitHub
commit 30f39fee9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 227 additions and 270 deletions

View file

@ -616,7 +616,7 @@ pub struct WhereEqPredicate<'hir> {
pub rhs_ty: &'hir Ty<'hir>,
}
#[derive(Encodable, Debug, HashStable_Generic)]
#[derive(Default, Encodable, Debug, HashStable_Generic)]
pub struct ModuleItems {
// Use BTreeSets here so items are in the same order as in the
// list of all items in Crate