}
}
-impl<CTX> stable_hasher::HashStable<CTX> for Fingerprint {
- #[inline]
- fn hash_stable<W: stable_hasher::StableHasherResult>(&self,
- _: &mut CTX,
- hasher: &mut stable_hasher::StableHasher<W>) {
- ::std::hash::Hash::hash(self, hasher);
- }
-}
+impl_stable_hash_via_hash!(Fingerprint);
impl serialize::UseSpecializedEncodable for Fingerprint { }
use session::{early_error, early_warn, Session};
use session::search_paths::SearchPaths;
-use ich::StableHashingContext;
use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel};
use rustc_target::spec::{Target, TargetTriple};
-use rustc_data_structures::stable_hasher::ToStableHashKey;
use lint;
use middle::cstore;
DepInfo,
}
-
-impl_stable_hash_for!(enum self::OutputType {
- Bitcode,
- Assembly,
- LlvmAssembly,
- Mir,
- Metadata,
- Object,
- Exe,
- DepInfo
-});
-
-impl<'a, 'tcx> ToStableHashKey<StableHashingContext<'a>> for OutputType {
- type KeyType = OutputType;
- #[inline]
- fn to_stable_hash_key(&self, _: &StableHashingContext<'a>) -> Self::KeyType {
- *self
- }
-}
+impl_stable_hash_via_hash!(OutputType);
impl OutputType {
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
#[derive(Clone, Hash)]
pub struct OutputTypes(BTreeMap<OutputType, Option<PathBuf>>);
-impl_stable_hash_for!(tuple_struct self::OutputTypes {
- map
-});
+impl_stable_hash_via_hash!(OutputTypes);
impl OutputTypes {
pub fn new(entries: &[(OutputType, Option<PathBuf>)]) -> OutputTypes {
}
}
-#[derive(Clone)]
+#[derive(Clone, Hash)]
pub struct OutputFilenames {
pub out_directory: PathBuf,
pub out_filestem: String,
pub outputs: OutputTypes,
}
-impl_stable_hash_for!(struct self::OutputFilenames {
- out_directory,
- out_filestem,
- single_output_file,
- extra,
- outputs
-});
+impl_stable_hash_via_hash!(OutputFilenames);
pub const RUST_CGU_EXT: &str = "rcgu";
// Implement HashStable by just calling `Hash::hash()`. This works fine for
// self-contained values that don't depend on the hashing context `CTX`.
+#[macro_export]
macro_rules! impl_stable_hash_via_hash {
($t:ty) => (
- impl<CTX> HashStable<CTX> for $t {
+ impl<CTX> $crate::stable_hasher::HashStable<CTX> for $t {
#[inline]
- fn hash_stable<W: StableHasherResult>(&self,
- _: &mut CTX,
- hasher: &mut StableHasher<W>) {
+ fn hash_stable<W: $crate::stable_hasher::StableHasherResult>(
+ &self,
+ _: &mut CTX,
+ hasher: &mut $crate::stable_hasher::StableHasher<W>
+ ) {
::std::hash::Hash::hash(self, hasher);
}
}