diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2025-07-02 20:15:28 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2025-07-13 13:50:01 +0000 |
| commit | 21fd82adbcaf322973ca6edb28a801be755a2225 (patch) | |
| tree | 72cc0e11a515961cd20d6393d37bacaf5a1e10d5 /compiler/rustc_hir/src | |
| parent | 5bd3841668f43626b89c9295de960cc7e2a3c2aa (diff) | |
| download | rust-21fd82adbcaf322973ca6edb28a801be755a2225.tar.gz rust-21fd82adbcaf322973ca6edb28a801be755a2225.zip | |
Retire hir::*ItemRef.
Diffstat (limited to 'compiler/rustc_hir/src')
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 32 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/intravisit.rs | 26 |
2 files changed, 11 insertions, 47 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index cdd1547fc60..80e07af8a46 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -4162,7 +4162,7 @@ impl<'hir> Item<'hir> { Ident, &'hir Generics<'hir>, GenericBounds<'hir>, - &'hir [TraitItemRef] + &'hir [TraitItemId] ), ItemKind::Trait(is_auto, safety, ident, generics, bounds, items), (*is_auto, *safety, *ident, generics, bounds, items); @@ -4335,7 +4335,7 @@ pub enum ItemKind<'hir> { /// A union definition, e.g., `union Foo<A, B> {x: A, y: B}`. Union(Ident, &'hir Generics<'hir>, VariantData<'hir>), /// A trait definition. - Trait(IsAuto, Safety, Ident, &'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemRef]), + Trait(IsAuto, Safety, Ident, &'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemId]), /// A trait alias. TraitAlias(Ident, &'hir Generics<'hir>, GenericBounds<'hir>), @@ -4362,7 +4362,7 @@ pub struct Impl<'hir> { pub of_trait: Option<TraitRef<'hir>>, pub self_ty: &'hir Ty<'hir>, - pub items: &'hir [ImplItemRef], + pub items: &'hir [ImplItemId], } impl ItemKind<'_> { @@ -4405,32 +4405,6 @@ impl ItemKind<'_> { } } -/// A reference from an trait to one of its associated 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 TraitItemRef { - pub id: TraitItemId, - pub ident: Ident, - pub span: Span, -} - -/// A reference from an impl to one of its associated 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 ImplItemRef { - pub id: ImplItemId, - pub ident: Ident, - pub span: Span, -} - // The bodies for items are stored "out of line", in a separate // hashmap in the `Crate`. Here we just record the hir-id of the item // so it can fetched later. diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index 552f17e0950..3edb94c28da 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -435,8 +435,8 @@ pub trait Visitor<'v>: Sized { fn visit_trait_item(&mut self, ti: &'v TraitItem<'v>) -> Self::Result { walk_trait_item(self, ti) } - fn visit_trait_item_ref(&mut self, ii: &'v TraitItemRef) -> Self::Result { - walk_trait_item_ref(self, ii) + fn visit_trait_item_ref(&mut self, ii: &'v TraitItemId) -> Self::Result { + walk_trait_item_ref(self, *ii) } fn visit_impl_item(&mut self, ii: &'v ImplItem<'v>) -> Self::Result { walk_impl_item(self, ii) @@ -444,8 +444,8 @@ pub trait Visitor<'v>: Sized { 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) + fn visit_impl_item_ref(&mut self, ii: &'v ImplItemId) -> Self::Result { + walk_impl_item_ref(self, *ii) } fn visit_trait_ref(&mut self, t: &'v TraitRef<'v>) -> Self::Result { walk_trait_ref(self, t) @@ -1245,13 +1245,8 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>( V::Result::output() } -pub fn walk_trait_item_ref<'v, V: Visitor<'v>>( - visitor: &mut V, - trait_item_ref: &'v TraitItemRef, -) -> V::Result { - let TraitItemRef { id, ident, span: _ } = *trait_item_ref; - try_visit!(visitor.visit_nested_trait_item(id)); - visitor.visit_ident(ident) +pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, id: TraitItemId) -> V::Result { + visitor.visit_nested_trait_item(id) } pub fn walk_impl_item<'v, V: Visitor<'v>>( @@ -1294,13 +1289,8 @@ pub fn walk_foreign_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, id: ForeignIte visitor.visit_nested_foreign_item(id) } -pub fn walk_impl_item_ref<'v, V: Visitor<'v>>( - visitor: &mut V, - impl_item_ref: &'v ImplItemRef, -) -> V::Result { - let ImplItemRef { id, ident, span: _ } = *impl_item_ref; - try_visit!(visitor.visit_nested_impl_item(id)); - visitor.visit_ident(ident) +pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, id: ImplItemId) -> V::Result { + visitor.visit_nested_impl_item(id) } pub fn walk_trait_ref<'v, V: Visitor<'v>>( |
