Auto merge of #84234 - jyn514:blanket-hash, r=Aaron1011
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. Noticed this while working on https://github.com/rust-lang/rust/pull/84233. r? `@Aaron1011`
This commit is contained in:
commit
9e6f0e878d
@ -2449,30 +2449,32 @@ fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) {
|
||||
)+};
|
||||
}
|
||||
|
||||
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,
|
||||
@ -2490,10 +2492,10 @@ fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) {
|
||||
TargetTriple,
|
||||
Edition,
|
||||
LinkerPluginLto,
|
||||
Option<SplitDebuginfo>,
|
||||
SplitDebuginfo,
|
||||
SwitchWithOptPath,
|
||||
Option<SymbolManglingVersion>,
|
||||
Option<SourceFileHashAlgorithm>,
|
||||
SymbolManglingVersion,
|
||||
SourceFileHashAlgorithm,
|
||||
TrimmedDefPaths,
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user