1
Fork 0

Remove hir::CrateItem.

This commit is contained in:
Camille GILLOT 2021-03-30 20:31:06 +02:00
parent 16156fb278
commit 9d8f833e05
15 changed files with 26 additions and 40 deletions

View file

@ -625,13 +625,6 @@ pub struct ModuleItems {
pub foreign_items: BTreeSet<ForeignItemId>,
}
/// A type representing only the top-level module.
#[derive(Encodable, Debug, HashStable_Generic)]
pub struct CrateItem<'hir> {
pub module: Mod<'hir>,
pub span: Span,
}
/// The top-level data structure that stores the entire contents of
/// the crate currently being compiled.
///
@ -640,7 +633,7 @@ pub struct CrateItem<'hir> {
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
#[derive(Debug)]
pub struct Crate<'hir> {
pub item: CrateItem<'hir>,
pub item: Mod<'hir>,
pub exported_macros: &'hir [MacroDef<'hir>],
// Attributes from non-exported macros, kept only for collecting the library feature list.
pub non_exported_macro_attrs: &'hir [Attribute],
@ -2983,7 +2976,7 @@ pub enum Node<'hir> {
GenericParam(&'hir GenericParam<'hir>),
Visibility(&'hir Visibility<'hir>),
Crate(&'hir CrateItem<'hir>),
Crate(&'hir Mod<'hir>),
}
impl<'hir> Node<'hir> {

View file

@ -478,7 +478,7 @@ pub trait Visitor<'v>: Sized {
/// Walks the contents of a crate. See also `Crate::visit_all_items`.
pub fn walk_crate<'v, V: Visitor<'v>>(visitor: &mut V, krate: &'v Crate<'v>) {
visitor.visit_mod(&krate.item.module, krate.item.span, CRATE_HIR_ID);
visitor.visit_mod(&krate.item, krate.item.inner, CRATE_HIR_ID);
walk_list!(visitor, visit_macro_def, krate.exported_macros);
for (&id, attrs) in krate.attrs.iter() {
for a in *attrs {