1
Fork 0

Rollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis

Remove defaultness from ImplItem.

This information is not really used anywhere, except HIR pretty-printing. This makes ImplItem and TraitItem more similar.
This commit is contained in:
Yuki Okushi 2022-02-09 14:12:22 +09:00 committed by GitHub
commit e5ac08779b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 21 deletions

View file

@ -2112,7 +2112,6 @@ pub struct ImplItem<'hir> {
pub ident: Ident,
pub def_id: LocalDefId,
pub vis: Visibility<'hir>,
pub defaultness: Defaultness,
pub generics: Generics<'hir>,
pub kind: ImplItemKind<'hir>,
pub span: Span,
@ -3310,6 +3309,6 @@ mod size_asserts {
rustc_data_structures::static_assert_size!(super::Item<'static>, 184);
rustc_data_structures::static_assert_size!(super::TraitItem<'static>, 128);
rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 152);
rustc_data_structures::static_assert_size!(super::ImplItem<'static>, 144);
rustc_data_structures::static_assert_size!(super::ForeignItem<'static>, 136);
}

View file

@ -1020,12 +1020,10 @@ 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, ref generics, ref kind, span: _ } =
*impl_item;
let ImplItem { def_id: _, ident, ref vis, ref generics, ref kind, span: _ } = *impl_item;
visitor.visit_ident(ident);
visitor.visit_vis(vis);
visitor.visit_defaultness(defaultness);
visitor.visit_generics(generics);
match *kind {
ImplItemKind::Const(ref ty, body) => {

View file

@ -164,13 +164,11 @@ 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 generics, ref kind, span } =
*self;
let ImplItem { def_id: _, ident, ref vis, 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);
generics.hash_stable(hcx, hasher);
kind.hash_stable(hcx, hasher);
span.hash_stable(hcx, hasher);