Skip to content

Commit c2b3deb

Browse files
Urgaumichaelwoerister
authored andcommitted
Return inner small hash in StableHasher::finish
1 parent 78e1196 commit c2b3deb

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
22

3+
- `StableHasher::finish` now returns a small hash instead of being fatal (#6)
34
- Remove `StableHasher::finalize` (#4)
45
- Import stable hasher implementation from rustc ([db8aca48129](https://github.com/rust-lang/rust/blob/db8aca48129d86b2623e3ac8cbcf2902d4d313ad/compiler/rustc_data_structures/src/))

src/stable_hasher.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,11 @@ impl fmt::Debug for StableHasher {
9797
}
9898

9999
impl Hasher for StableHasher {
100-
/// <div class="warning">
100+
/// Returns a combined hash.
101101
///
102-
/// Do not use this function, it will unconditionnaly panic.
103-
///
104-
/// Use instead [`StableHasher::finish`] which returns a
105-
/// `[u64; 2]` for greater precision.
106-
///
107-
/// </div>
102+
/// For greater precision use instead [`StableHasher::finish`].
108103
fn finish(&self) -> u64 {
109-
panic!("use StableHasher::finalize instead");
104+
self.state.finish()
110105
}
111106

112107
#[inline]

0 commit comments

Comments
 (0)