1
Fork 0

Merge the BTreeMap in hir::Crate.

This commit is contained in:
Camille GILLOT 2021-02-05 15:47:44 +01:00
parent 0443424954
commit 36a28060f1
14 changed files with 268 additions and 119 deletions

View file

@ -81,14 +81,10 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
let Crate {
ref item,
// These fields are handled separately:
exported_macros: _,
non_exported_macro_attrs: _,
items: _,
trait_items: _,
impl_items: _,
foreign_items: _,
bodies: _,
owners: _,
trait_impls: _,
bodies: _,
body_ids: _,
modules: _,
proc_macros: _,

View file

@ -554,8 +554,8 @@ impl<'hir> Map<'hir> {
where
V: Visitor<'hir>,
{
for id in self.krate().exported_macros {
visitor.visit_macro_def(self.expect_macro_def(id.hir_id()));
for macro_def in self.krate().exported_macros() {
visitor.visit_macro_def(macro_def);
}
}

View file

@ -2307,7 +2307,7 @@ define_print_and_forward_display! {
fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, Namespace, DefId)) {
// Iterate all local crate items no matter where they are defined.
let hir = tcx.hir();
for item in hir.krate().items.values() {
for item in hir.krate().items() {
if item.ident.name.as_str().is_empty() || matches!(item.kind, ItemKind::Use(_, _)) {
continue;
}