@@ -548,10 +548,12 @@ mod impls {
548
548
( $( ( $ty: ident, $meth: ident) , ) * ) => { $(
549
549
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
550
550
impl Hash for $ty {
551
+ #[ inline]
551
552
fn hash<H : Hasher >( & self , state: & mut H ) {
552
553
state. $meth( * self )
553
554
}
554
555
556
+ #[ inline]
555
557
fn hash_slice<H : Hasher >( data: & [ $ty] , state: & mut H ) {
556
558
let newlen = data. len( ) * mem:: size_of:: <$ty>( ) ;
557
559
let ptr = data. as_ptr( ) as * const u8 ;
@@ -582,20 +584,23 @@ mod impls {
582
584
583
585
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
584
586
impl Hash for bool {
587
+ #[ inline]
585
588
fn hash < H : Hasher > ( & self , state : & mut H ) {
586
589
state. write_u8 ( * self as u8 )
587
590
}
588
591
}
589
592
590
593
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
591
594
impl Hash for char {
595
+ #[ inline]
592
596
fn hash < H : Hasher > ( & self , state : & mut H ) {
593
597
state. write_u32 ( * self as u32 )
594
598
}
595
599
}
596
600
597
601
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
598
602
impl Hash for str {
603
+ #[ inline]
599
604
fn hash < H : Hasher > ( & self , state : & mut H ) {
600
605
state. write ( self . as_bytes ( ) ) ;
601
606
state. write_u8 ( 0xff )
@@ -604,6 +609,7 @@ mod impls {
604
609
605
610
#[ stable( feature = "never_hash" , since = "1.29.0" ) ]
606
611
impl Hash for ! {
612
+ #[ inline]
607
613
fn hash < H : Hasher > ( & self , _: & mut H ) {
608
614
* self
609
615
}
@@ -613,6 +619,7 @@ mod impls {
613
619
( ) => (
614
620
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
615
621
impl Hash for ( ) {
622
+ #[ inline]
616
623
fn hash<H : Hasher >( & self , _state: & mut H ) { }
617
624
}
618
625
) ;
@@ -621,6 +628,7 @@ mod impls {
621
628
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
622
629
impl <$( $name: Hash ) ,+> Hash for ( $( $name, ) +) where last_type!( $( $name, ) +) : ?Sized {
623
630
#[ allow( non_snake_case) ]
631
+ #[ inline]
624
632
fn hash<S : Hasher >( & self , state: & mut S ) {
625
633
let ( $( ref $name, ) +) = * self ;
626
634
$( $name. hash( state) ; ) +
@@ -650,6 +658,7 @@ mod impls {
650
658
651
659
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
652
660
impl < T : Hash > Hash for [ T ] {
661
+ #[ inline]
653
662
fn hash < H : Hasher > ( & self , state : & mut H ) {
654
663
self . len ( ) . hash ( state) ;
655
664
Hash :: hash_slice ( self , state)
@@ -658,20 +667,23 @@ mod impls {
658
667
659
668
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
660
669
impl < T : ?Sized + Hash > Hash for & T {
670
+ #[ inline]
661
671
fn hash < H : Hasher > ( & self , state : & mut H ) {
662
672
( * * self ) . hash ( state) ;
663
673
}
664
674
}
665
675
666
676
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
667
677
impl < T : ?Sized + Hash > Hash for & mut T {
678
+ #[ inline]
668
679
fn hash < H : Hasher > ( & self , state : & mut H ) {
669
680
( * * self ) . hash ( state) ;
670
681
}
671
682
}
672
683
673
684
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
674
685
impl < T : ?Sized > Hash for * const T {
686
+ #[ inline]
675
687
fn hash < H : Hasher > ( & self , state : & mut H ) {
676
688
#[ cfg( not( bootstrap) ) ]
677
689
{
@@ -701,6 +713,7 @@ mod impls {
701
713
702
714
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
703
715
impl < T : ?Sized > Hash for * mut T {
716
+ #[ inline]
704
717
fn hash < H : Hasher > ( & self , state : & mut H ) {
705
718
#[ cfg( not( bootstrap) ) ]
706
719
{
0 commit comments