Retire hir::ForeignItemRef.

This commit is contained in:
Camille GILLOT
2025-07-03 09:32:11 +00:00
parent 36bc0948e0
commit 5bd3841668
11 changed files with 40 additions and 66 deletions

View File

@@ -4138,7 +4138,7 @@ impl<'hir> Item<'hir> {
expect_mod, (Ident, &'hir Mod<'hir>), ItemKind::Mod(ident, m), (*ident, m);
expect_foreign_mod, (ExternAbi, &'hir [ForeignItemRef]),
expect_foreign_mod, (ExternAbi, &'hir [ForeignItemId]),
ItemKind::ForeignMod { abi, items }, (*abi, items);
expect_global_asm, &'hir InlineAsm<'hir>, ItemKind::GlobalAsm { asm, .. }, asm;
@@ -4315,7 +4315,7 @@ pub enum ItemKind<'hir> {
/// A module.
Mod(Ident, &'hir Mod<'hir>),
/// An external module, e.g. `extern { .. }`.
ForeignMod { abi: ExternAbi, items: &'hir [ForeignItemRef] },
ForeignMod { abi: ExternAbi, items: &'hir [ForeignItemId] },
/// Module-level inline assembly (from `global_asm!`).
GlobalAsm {
asm: &'hir InlineAsm<'hir>,
@@ -4447,19 +4447,6 @@ impl ForeignItemId {
}
}
/// A reference from a foreign block to one of its items. This
/// contains the item's ID, naturally, but also the item's name and
/// some other high-level details (like whether it is an associated
/// type or method, and whether it is public). This allows other
/// passes to find the impl they want without loading the ID (which
/// means fewer edges in the incremental compilation graph).
#[derive(Debug, Clone, Copy, HashStable_Generic)]
pub struct ForeignItemRef {
pub id: ForeignItemId,
pub ident: Ident,
pub span: Span,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
pub struct ForeignItem<'hir> {
pub ident: Ident,

View File

@@ -441,8 +441,8 @@ pub trait Visitor<'v>: Sized {
fn visit_impl_item(&mut self, ii: &'v ImplItem<'v>) -> Self::Result {
walk_impl_item(self, ii)
}
fn visit_foreign_item_ref(&mut self, ii: &'v ForeignItemRef) -> Self::Result {
walk_foreign_item_ref(self, ii)
fn visit_foreign_item_ref(&mut self, ii: &'v ForeignItemId) -> Self::Result {
walk_foreign_item_ref(self, *ii)
}
fn visit_impl_item_ref(&mut self, ii: &'v ImplItemRef) -> Self::Result {
walk_impl_item_ref(self, ii)
@@ -1290,13 +1290,8 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(
}
}
pub fn walk_foreign_item_ref<'v, V: Visitor<'v>>(
visitor: &mut V,
foreign_item_ref: &'v ForeignItemRef,
) -> V::Result {
let ForeignItemRef { id, ident, span: _ } = *foreign_item_ref;
try_visit!(visitor.visit_nested_foreign_item(id));
visitor.visit_ident(ident)
pub fn walk_foreign_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, id: ForeignItemId) -> V::Result {
visitor.visit_nested_foreign_item(id)
}
pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(