From 76502deb53f5b30e0ee7f132ba23f8e31263853c Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 15 Apr 2021 19:36:25 -0400 Subject: [PATCH] Implement DepTrackingHash for `Option` through blanket impls instead of macros This avoids having to add a new macro call for both the `Option` and the type itself. --- compiler/rustc_session/src/config.rs | 42 +++++++++++++++------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 52f8b536f4a..49637529234 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2427,30 +2427,32 @@ fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) { )+}; } + impl DepTrackingHash for Option { + fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) { + match self { + Some(x) => { + Hash::hash(&1, hasher); + DepTrackingHash::hash(x, hasher, error_format); + } + None => Hash::hash(&0, hasher), + } + } + } + impl_dep_tracking_hash_via_hash!( bool, usize, + NonZeroUsize, u64, String, PathBuf, lint::Level, - Option, - Option, - Option, - Option, - Option, - Option<(String, u64)>, - Option>, - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, - Option, + WasiExecModel, + u32, + RelocModel, + CodeModel, + TlsModel, + InstrumentCoverage, CrateType, MergeFunctions, PanicStrategy, @@ -2468,10 +2470,10 @@ fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) { TargetTriple, Edition, LinkerPluginLto, - Option, + SplitDebuginfo, SwitchWithOptPath, - Option, - Option, + SymbolManglingVersion, + SourceFileHashAlgorithm, TrimmedDefPaths, );