@@ -559,14 +559,25 @@ impl<'enc, 'a, 'tcx, E> CacheEncoder<'enc, 'a, 'tcx, E>
559559impl < ' enc , ' a , ' tcx , E > ty_codec:: TyEncoder for CacheEncoder < ' enc , ' a , ' tcx , E >
560560 where E : ' enc + ty_codec:: TyEncoder
561561{
562+ #[ inline]
562563 fn position ( & self ) -> usize {
563564 self . encoder . position ( )
564565 }
565566}
566567
568+ impl < ' enc , ' a , ' tcx , E > SpecializedEncoder < CrateNum > for CacheEncoder < ' enc , ' a , ' tcx , E >
569+ where E : ' enc + ty_codec:: TyEncoder
570+ {
571+ #[ inline]
572+ fn specialized_encode ( & mut self , cnum : & CrateNum ) -> Result < ( ) , Self :: Error > {
573+ self . emit_u32 ( cnum. as_u32 ( ) )
574+ }
575+ }
576+
567577impl < ' enc , ' a , ' tcx , E > SpecializedEncoder < ty:: Ty < ' tcx > > for CacheEncoder < ' enc , ' a , ' tcx , E >
568578 where E : ' enc + ty_codec:: TyEncoder
569579{
580+ #[ inline]
570581 fn specialized_encode ( & mut self , ty : & ty:: Ty < ' tcx > ) -> Result < ( ) , Self :: Error > {
571582 ty_codec:: encode_with_shorthand ( self , ty,
572583 |encoder| & mut encoder. type_shorthands )
@@ -577,6 +588,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<ty::GenericPredicates<'tcx>>
577588 for CacheEncoder < ' enc , ' a , ' tcx , E >
578589 where E : ' enc + ty_codec:: TyEncoder
579590{
591+ #[ inline]
580592 fn specialized_encode ( & mut self ,
581593 predicates : & ty:: GenericPredicates < ' tcx > )
582594 -> Result < ( ) , Self :: Error > {
@@ -588,6 +600,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<ty::GenericPredicates<'tcx>>
588600impl < ' enc , ' a , ' tcx , E > SpecializedEncoder < hir:: HirId > for CacheEncoder < ' enc , ' a , ' tcx , E >
589601 where E : ' enc + ty_codec:: TyEncoder
590602{
603+ #[ inline]
591604 fn specialized_encode ( & mut self , id : & hir:: HirId ) -> Result < ( ) , Self :: Error > {
592605 let hir:: HirId {
593606 owner,
@@ -605,6 +618,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<hir::HirId> for CacheEncoder<'enc, 'a
605618impl < ' enc , ' a , ' tcx , E > SpecializedEncoder < DefId > for CacheEncoder < ' enc , ' a , ' tcx , E >
606619 where E : ' enc + ty_codec:: TyEncoder
607620{
621+ #[ inline]
608622 fn specialized_encode ( & mut self , id : & DefId ) -> Result < ( ) , Self :: Error > {
609623 let def_path_hash = self . tcx . def_path_hash ( * id) ;
610624 def_path_hash. encode ( self )
@@ -614,6 +628,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<DefId> for CacheEncoder<'enc, 'a, 'tc
614628impl < ' enc , ' a , ' tcx , E > SpecializedEncoder < LocalDefId > for CacheEncoder < ' enc , ' a , ' tcx , E >
615629 where E : ' enc + ty_codec:: TyEncoder
616630{
631+ #[ inline]
617632 fn specialized_encode ( & mut self , id : & LocalDefId ) -> Result < ( ) , Self :: Error > {
618633 id. to_def_id ( ) . encode ( self )
619634 }
@@ -632,6 +647,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<DefIndex> for CacheEncoder<'enc, 'a,
632647impl < ' enc , ' a , ' tcx , E > SpecializedEncoder < NodeId > for CacheEncoder < ' enc , ' a , ' tcx , E >
633648 where E : ' enc + ty_codec:: TyEncoder
634649{
650+ #[ inline]
635651 fn specialized_encode ( & mut self , node_id : & NodeId ) -> Result < ( ) , Self :: Error > {
636652 let hir_id = self . tcx . hir . node_to_hir_id ( * node_id) ;
637653 hir_id. encode ( self )
0 commit comments