4242//! be the natural one, *e.g.* `HConSet<Term>`.
4343//!
4444//! However, since `Term` is really an alias for `HConsed<RTerm>`, then if we wanted to declare
45- //! `HConSet` as an alias for `HashSet` we would get `type HConSet<Inner> = HashSet< HConsed<Inner>
46- //! >` (omitting the custom hasher). That is, our sets would have type `HConSet<RTerm>`, which is
47- //! not very pretty. We could just define an alias though: `type TermSet = HConSet<RTerm>`, but it
48- //! turns out it's better to wrap the actual set in a `struct` anyway. Mostly to be able to define
49- //! `new` and `with_capacity` without relying on a trait (users would need to import) to do that.
45+ //! `HConSet` as an alias for `HashSet` we would get `type HConSet<Inner> = HashSet<HConsed<Inner>>`
46+ //! (omitting the custom hasher). That is, our sets would have type `HConSet<RTerm>`, which is not
47+ //! very pretty. We could just define an alias though: `type TermSet = HConSet<RTerm>`, but it turns
48+ //! out it's better to wrap the actual set in a `struct` anyway. Mostly to be able to define `new`
49+ //! and `with_capacity` without relying on a trait (users would need to import) to do that.
5050//!
5151//! So actually `HConsed` types automatically implement the internal `trait HashConsed { type Inner;
5252//! }`. The sole purpose of this trait (currently) is to pass the inner type implicitly thanks to a
@@ -322,7 +322,7 @@ where
322322{
323323 /// An iterator visiting all elements.
324324 #[ inline]
325- pub fn iter ( & self ) -> :: std:: collections:: hash_set:: Iter < HConsed < T :: Inner > > {
325+ pub fn iter < ' a > ( & ' a self ) -> :: std:: collections:: hash_set:: Iter < ' a , HConsed < T :: Inner > > {
326326 self . set . iter ( )
327327 }
328328}
@@ -520,12 +520,14 @@ where
520520{
521521 /// An iterator visiting all elements.
522522 #[ inline]
523- pub fn iter ( & self ) -> :: std:: collections:: hash_map:: Iter < HConsed < T :: Inner > , V > {
523+ pub fn iter < ' a > ( & ' a self ) -> :: std:: collections:: hash_map:: Iter < ' a , HConsed < T :: Inner > , V > {
524524 self . map . iter ( )
525525 }
526526 /// An iterator visiting all elements.
527527 #[ inline]
528- pub fn iter_mut ( & mut self ) -> :: std:: collections:: hash_map:: IterMut < HConsed < T :: Inner > , V > {
528+ pub fn iter_mut < ' a > (
529+ & ' a mut self ,
530+ ) -> :: std:: collections:: hash_map:: IterMut < ' a , HConsed < T :: Inner > , V > {
529531 self . map . iter_mut ( )
530532 }
531533}
@@ -643,7 +645,7 @@ mod hash {
643645 impl HashU64 {
644646 /// Checks that a slice of bytes has the length of a `usize`. Only active
645647 /// in debug.
646- #[ cfg( debug ) ]
648+ #[ cfg( debug_assertions ) ]
647649 #[ inline( always) ]
648650 fn test_bytes ( bytes : & [ u8 ] ) {
649651 if bytes. len ( ) != 8 {
@@ -657,13 +659,13 @@ mod hash {
657659 }
658660 /// Checks that a slice of bytes has the length of a `usize`. Only active
659661 /// in debug.
660- #[ cfg( not( debug ) ) ]
662+ #[ cfg( not( debug_assertions ) ) ]
661663 #[ inline( always) ]
662664 fn test_bytes ( _: & [ u8 ] ) { }
663665 }
664666 impl Hasher for HashU64 {
665667 fn finish ( & self ) -> u64 {
666- let block: u64 = unsafe { :: std :: mem :: transmute ( self . buf ) } ;
668+ let block: u64 = u64 :: from_ne_bytes ( self . buf ) ;
667669 // Multiply by random 64-bit prime to distribute
668670 block. wrapping_mul ( 0xDA5DF7A7BD02F2C7u64 )
669671 }
0 commit comments