fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
        let def_id = self.tcx.hir.local_def_id(item.id);
        match item.node {
            hir::ItemStatic(..) |
            hir::ItemConst(..) |
            hir::ItemFn(..) |
            hir::ItemMod(..) |
            hir::ItemForeignMod(..) |
            hir::ItemExternCrate(..) |
            hir::ItemUse(..) |
            hir::ItemDefaultImpl(..) |
            hir::ItemTy(..) => {
                // no sub-item recording needed in these cases
            }
            hir::ItemEnum(..) => {
                self.encode_fields(def_id);

                let def = self.tcx.lookup_adt_def(def_id);
                for (i, variant) in def.variants.iter().enumerate() {
                    self.record(variant.did,
                                EncodeContext::encode_enum_variant_info,
                                (def_id, Untracked(i)));
                }
            }
            hir::ItemStruct(ref struct_def, _) => {
                self.encode_fields(def_id);

                // If the struct has a constructor, encode it.
                if !struct_def.is_struct() {
                    let ctor_def_id = self.tcx.hir.local_def_id(struct_def.id());
                    self.record(ctor_def_id,
                                EncodeContext::encode_struct_ctor,
                                (def_id, ctor_def_id));
                }
            }
            hir::ItemUnion(..) => {
                self.encode_fields(def_id);
            }
            hir::ItemImpl(..) => {
                for &trait_item_def_id in &self.tcx.associated_item_def_ids(def_id)[..] {
                    self.record(trait_item_def_id,
                                EncodeContext::encode_info_for_impl_item,
                                trait_item_def_id);
                }
            }
            hir::ItemTrait(..) => {
                for &item_def_id in &self.tcx.associated_item_def_ids(def_id)[..] {
                    self.record(item_def_id,
                                EncodeContext::encode_info_for_trait_item,
                                item_def_id);
                }
            }
        }
    }
/// In some cases, along with the item itself, we also
/// encode some sub-items. Usually we want some info from the item
/// so it's easier to do that here then to wait until we would encounter
/// normally in the visitor walk.
In some cases, along with the item itself, we also
encode some sub-items. Usually we want some info from the item
so it's easier to do that here then to wait until we would encounter
normally in the visitor walk.
In some cases along with the item itself we also encode some sub - items . Usually we want some info from the item so it ' s easier to do that here then to wait until we would encounter normally in the visitor walk .
fn encode_addl_info_for_item(&mut self, item: &hir::Item) {
        let def_id = self.tcx.hir.local_def_id(item.id);
        match item.node {
            hir::ItemStatic(..) |
            hir::ItemConst(..) |
            hir::ItemFn(..) |
            hir::ItemMod(..) |
            hir::ItemForeignMod(..) |
            hir::ItemExternCrate(..) |
            hir::ItemUse(..) |
            hir::ItemDefaultImpl(..) |
            hir::ItemTy(..) => {
                // no sub-item recording needed in these cases
            }
            hir::ItemEnum(..) => {
                self.encode_fields(def_id);
                let def = self.tcx.lookup_adt_def(def_id);
                for (i, variant) in def.variants.iter().enumerate() {
                    self.record(variant.did,
                                EncodeContext::encode_enum_variant_info,
                                (def_id, Untracked(i)));
                }
            }
            hir::ItemStruct(ref struct_def, _) => {
                self.encode_fields(def_id);
                // If the struct has a constructor, encode it.
                if !struct_def.is_struct() {
                    let ctor_def_id = self.tcx.hir.local_def_id(struct_def.id());
                    self.record(ctor_def_id,
                                EncodeContext::encode_struct_ctor,
                                (def_id, ctor_def_id));
                }
            }
            hir::ItemUnion(..) => {
                self.encode_fields(def_id);
            }
            hir::ItemImpl(..) => {
                for &trait_item_def_id in &self.tcx.associated_item_def_ids(def_id)[..] {
                    self.record(trait_item_def_id,
                                EncodeContext::encode_info_for_impl_item,
                                trait_item_def_id);
                }
            }
            hir::ItemTrait(..) => {
                for &item_def_id in &self.tcx.associated_item_def_ids(def_id)[..] {
                    self.record(item_def_id,
                                EncodeContext::encode_info_for_trait_item,
                                item_def_id);
                }
            }
        }
    }
fn encode_addl_info_for_item ( & mut self , item : & hir :: Item ) { let def_id = self . tcx . hir . local_def_id ( item . id ) ; match item . node { hir :: ItemStatic ( .. ) | hir :: ItemConst ( .. ) | hir :: ItemFn ( .. ) | hir :: ItemMod ( .. ) | hir :: ItemForeignMod ( .. ) | hir :: ItemExternCrate ( .. ) | hir :: ItemUse ( .. ) | hir :: ItemDefaultImpl ( .. ) | hir :: ItemTy ( .. ) => { // no sub-item recording needed in these cases } hir :: ItemEnum ( .. ) => { self . encode_fields ( def_id ) ; let def = self . tcx . lookup_adt_def ( def_id ) ; for ( i , variant ) in def . variants . iter ( ) . enumerate ( ) { self . record ( variant . did , EncodeContext :: encode_enum_variant_info , ( def_id , Untracked ( i ) ) ) ; } } hir :: ItemStruct ( ref struct_def , _ ) => { self . encode_fields ( def_id ) ; // If the struct has a constructor, encode it. if ! struct_def . is_struct ( ) { let ctor_def_id = self . tcx . hir . local_def_id ( struct_def . id ( ) ) ; self . record ( ctor_def_id , EncodeContext :: encode_struct_ctor , ( def_id , ctor_def_id ) ) ; } } hir :: ItemUnion ( .. ) => { self . encode_fields ( def_id ) ; } hir :: ItemImpl ( .. ) => { for & trait_item_def_id in & self . tcx . associated_item_def_ids ( def_id ) [ .. ] { self . record ( trait_item_def_id , EncodeContext :: encode_info_for_impl_item , trait_item_def_id ) ; } } hir :: ItemTrait ( .. ) => { for & item_def_id in & self . tcx . associated_item_def_ids ( def_id ) [ .. ] { self . record ( item_def_id , EncodeContext :: encode_info_for_trait_item , item_def_id ) ; } } } }
In some cases, along with the item itself, we also
encode some sub-items.
In some cases along with the item itself we also encode some sub - items .
&mut self
item
&hir::Item