diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-04-15 19:36:25 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-06-04 08:46:59 -0400 |
| commit | 76502deb53f5b30e0ee7f132ba23f8e31263853c (patch) | |
| tree | 791006b16ca0972bbe892344cf5fbc6954c6df1f /compiler/rustc_session | |
| parent | c4c2ab57a43737867982fafc8cfacd9b069fee96 (diff) | |
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.
Diffstat (limited to 'compiler/rustc_session')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 42 |
1 files 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 @@ crate mod dep_tracking { )+}; } + impl<T: DepTrackingHash> DepTrackingHash for Option<T> { + 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<bool>, - Option<u32>, - Option<usize>, - Option<NonZeroUsize>, - Option<String>, - Option<(String, u64)>, - Option<Vec<String>>, - Option<MergeFunctions>, - Option<RelocModel>, - Option<CodeModel>, - Option<TlsModel>, - Option<WasiExecModel>, - Option<PanicStrategy>, - Option<RelroLevel>, - Option<InstrumentCoverage>, - Option<lint::Level>, - Option<PathBuf>, + WasiExecModel, + u32, + RelocModel, + CodeModel, + TlsModel, + InstrumentCoverage, CrateType, MergeFunctions, PanicStrategy, @@ -2468,10 +2470,10 @@ crate mod dep_tracking { TargetTriple, Edition, LinkerPluginLto, - Option<SplitDebuginfo>, + SplitDebuginfo, SwitchWithOptPath, - Option<SymbolManglingVersion>, - Option<SourceFileHashAlgorithm>, + SymbolManglingVersion, + SourceFileHashAlgorithm, TrimmedDefPaths, ); |
