Fallout: add phantomdata to hash

This commit is contained in:
Niko Matsakis 2015-02-12 12:46:40 -05:00
parent ae7c534d04
commit 6f2a1c9467

View File

@ -11,6 +11,7 @@
use clone::Clone;
use default::Default;
use hash;
use marker;
/// A trait representing stateful hashes which can be used to hash keys in a
/// `HashMap`.
@ -37,7 +38,7 @@ pub trait HashState {
///
/// This struct has is 0-sized and does not need construction.
#[unstable(feature = "std_misc", reason = "hasher stuff is unclear")]
pub struct DefaultState<H>;
pub struct DefaultState<H>(marker::PhantomData<H>);
impl<H: Default + hash::Hasher> HashState for DefaultState<H> {
type Hasher = H;
@ -45,9 +46,9 @@ impl<H: Default + hash::Hasher> HashState for DefaultState<H> {
}
impl<H> Clone for DefaultState<H> {
fn clone(&self) -> DefaultState<H> { DefaultState }
fn clone(&self) -> DefaultState<H> { DefaultState(marker::PhantomData) }
}
impl<H> Default for DefaultState<H> {
fn default() -> DefaultState<H> { DefaultState }
fn default() -> DefaultState<H> { DefaultState(marker::PhantomData) }
}