Remove hir::ImplItem::attrs.
This commit is contained in:
parent
c49359add2
commit
5474f17011
13 changed files with 23 additions and 36 deletions
|
@ -931,10 +931,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
let has_value = true;
|
||||
let (defaultness, _) = self.lower_defaultness(i.kind.defaultness(), has_value);
|
||||
let hir_id = self.lower_node_id(i.id);
|
||||
self.lower_attrs(hir_id, &i.attrs);
|
||||
hir::ImplItem {
|
||||
def_id: hir_id.expect_owner(),
|
||||
ident: i.ident,
|
||||
attrs: self.lower_attrs(hir_id, &i.attrs),
|
||||
generics,
|
||||
vis: self.lower_visibility(&i.vis, None),
|
||||
defaultness,
|
||||
|
|
|
@ -2090,7 +2090,6 @@ pub struct ImplItem<'hir> {
|
|||
pub def_id: LocalDefId,
|
||||
pub vis: Visibility<'hir>,
|
||||
pub defaultness: Defaultness,
|
||||
pub attrs: &'hir [Attribute],
|
||||
pub generics: Generics<'hir>,
|
||||
pub kind: ImplItemKind<'hir>,
|
||||
pub span: Span,
|
||||
|
@ -3080,6 +3079,6 @@ mod size_asserts {
|
|||
|
||||
rustc_data_structures::static_assert_size!(super::Item<'static>, 200);
|
||||
rustc_data_structures::static_assert_size!(super::TraitItem<'static>, 128);
|
||||
rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 168);
|
||||
rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 152);
|
||||
rustc_data_structures::static_assert_size!(super::ForeignItem<'static>, 136);
|
||||
}
|
||||
|
|
|
@ -988,16 +988,8 @@ pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref:
|
|||
|
||||
pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplItem<'v>) {
|
||||
// N.B., deliberately force a compilation error if/when new fields are added.
|
||||
let ImplItem {
|
||||
def_id: _,
|
||||
ident,
|
||||
ref vis,
|
||||
ref defaultness,
|
||||
attrs: _,
|
||||
ref generics,
|
||||
ref kind,
|
||||
span: _,
|
||||
} = *impl_item;
|
||||
let ImplItem { def_id: _, ident, ref vis, ref defaultness, ref generics, ref kind, span: _ } =
|
||||
*impl_item;
|
||||
|
||||
visitor.visit_ident(ident);
|
||||
visitor.visit_vis(vis);
|
||||
|
|
|
@ -152,22 +152,13 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for TraitItem<'_> {
|
|||
|
||||
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for ImplItem<'_> {
|
||||
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
|
||||
let ImplItem {
|
||||
def_id: _,
|
||||
ident,
|
||||
ref vis,
|
||||
defaultness,
|
||||
ref attrs,
|
||||
ref generics,
|
||||
ref kind,
|
||||
span,
|
||||
} = *self;
|
||||
let ImplItem { def_id: _, ident, ref vis, defaultness, ref generics, ref kind, span } =
|
||||
*self;
|
||||
|
||||
hcx.hash_hir_item_like(|hcx| {
|
||||
ident.name.hash_stable(hcx, hasher);
|
||||
vis.hash_stable(hcx, hasher);
|
||||
defaultness.hash_stable(hcx, hasher);
|
||||
attrs.hash_stable(hcx, hasher);
|
||||
generics.hash_stable(hcx, hasher);
|
||||
kind.hash_stable(hcx, hasher);
|
||||
span.hash_stable(hcx, hasher);
|
||||
|
|
|
@ -988,7 +988,7 @@ impl<'a> State<'a> {
|
|||
self.ann.pre(self, AnnNode::SubItem(ii.hir_id()));
|
||||
self.hardbreak_if_not_bol();
|
||||
self.maybe_print_comment(ii.span.lo());
|
||||
self.print_outer_attributes(&ii.attrs);
|
||||
self.print_outer_attributes(self.attrs(ii.hir_id()));
|
||||
self.print_defaultness(ii.defaultness);
|
||||
|
||||
match ii.kind {
|
||||
|
|
|
@ -1067,6 +1067,7 @@ impl<'tcx> DumpVisitor<'tcx> {
|
|||
match impl_item.kind {
|
||||
hir::ImplItemKind::Const(ref ty, body) => {
|
||||
let body = self.tcx.hir().body(body);
|
||||
let attrs = self.tcx.hir().attrs(impl_item.hir_id());
|
||||
self.process_assoc_const(
|
||||
impl_item.hir_id(),
|
||||
impl_item.ident,
|
||||
|
@ -1074,7 +1075,7 @@ impl<'tcx> DumpVisitor<'tcx> {
|
|||
Some(&body.value),
|
||||
impl_id,
|
||||
&impl_item.vis,
|
||||
&impl_item.attrs,
|
||||
attrs,
|
||||
);
|
||||
}
|
||||
hir::ImplItemKind::Fn(ref sig, body) => {
|
||||
|
|
|
@ -426,9 +426,9 @@ impl<'tcx> SaveContext<'tcx> {
|
|||
let trait_id = self.tcx.trait_id_of_impl(impl_id);
|
||||
let mut docs = String::new();
|
||||
let mut attrs = vec![];
|
||||
if let Some(Node::ImplItem(item)) = hir.find(hir_id) {
|
||||
docs = self.docs_for_attrs(&item.attrs);
|
||||
attrs = item.attrs.to_vec();
|
||||
if let Some(Node::ImplItem(_)) = hir.find(hir_id) {
|
||||
attrs = self.tcx.hir().attrs(hir_id).to_vec();
|
||||
docs = self.docs_for_attrs(&attrs);
|
||||
}
|
||||
|
||||
let mut decl_id = None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue