Skip to content

Commit 22d3669

Browse files
committed
auto merge of #11863 : erickt/rust/hash, r=acrichto
This PR merges `IterBytes` and `Hash` into a trait that allows for generic non-stream-based hashing. It makes use of @eddyb's default type parameter support in order to have a similar usage to the old `Hash` framework. Fixes #8038. Todo: - [x] Better documentation - [ ] Benchmark - [ ] Parameterize `HashMap` on a `Hasher`.
2 parents 2ba0a8a + ca6d512 commit 22d3669

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1191
-17
lines changed

src/etc/generate-deriving-span-tests.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ def write_file(name, string):
119119
('Clone', [], 1), ('DeepClone', ['Clone'], 1),
120120
('Eq', [], 2), ('Ord', [], 8),
121121
('TotalEq', [], 1), ('TotalOrd', ['TotalEq'], 1),
122-
('Show', [], 1)]:
122+
('Show', [], 1),
123+
('Hash', [], 1)]:
123124
traits[trait] = (ALL, supers, errs)
124125

125126
for (trait, (types, super_traits, error_count)) in traits.items():

src/libextra/stats.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#[allow(missing_doc)];
1212

1313
use std::cmp;
14+
use std::hash_old::Hash;
1415
use std::hashmap;
1516
use std::io;
1617
use std::mem;

src/librustc/metadata/decoder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use middle::typeck;
2727
use middle::astencode::vtable_decoder_helpers;
2828

2929
use std::u64;
30+
use std::hash_old::Hash;
3031
use std::io;
3132
use std::io::extensions::u64_from_be_bytes;
3233
use std::option;

src/librustc/metadata/encoder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use middle;
2626
use serialize::Encodable;
2727
use std::cast;
2828
use std::cell::{Cell, RefCell};
29+
use std::hash_old::Hash;
2930
use std::hashmap::{HashMap, HashSet};
3031
use std::io::MemWriter;
3132
use std::str;

src/librustc/middle/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4916,7 +4916,7 @@ pub fn trait_method_of_method(tcx: ctxt,
49164916
/// Creates a hash of the type `t` which will be the same no matter what crate
49174917
/// context it's calculated within. This is used by the `type_id` intrinsic.
49184918
pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
4919-
use std::hash::{SipState, Streaming};
4919+
use std::hash_old::{SipState, Streaming};
49204920

49214921
let mut hash = SipState::new(0, 0);
49224922
let region = |_hash: &mut SipState, r: Region| {

src/libserialize/serialize.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Core encoding and decoding interfaces.
1515
*/
1616

17+
use std::hash_old::Hash;
1718
use std::hashmap::{HashMap, HashSet};
1819
use std::rc::Rc;
1920
use std::trie::{TrieMap, TrieSet};

0 commit comments

Comments
 (0)