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.
This commit is contained in:
parent
c4c2ab57a4
commit
76502deb53
1 changed files with 22 additions and 20 deletions
|
@ -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!(
|
impl_dep_tracking_hash_via_hash!(
|
||||||
bool,
|
bool,
|
||||||
usize,
|
usize,
|
||||||
|
NonZeroUsize,
|
||||||
u64,
|
u64,
|
||||||
String,
|
String,
|
||||||
PathBuf,
|
PathBuf,
|
||||||
lint::Level,
|
lint::Level,
|
||||||
Option<bool>,
|
WasiExecModel,
|
||||||
Option<u32>,
|
u32,
|
||||||
Option<usize>,
|
RelocModel,
|
||||||
Option<NonZeroUsize>,
|
CodeModel,
|
||||||
Option<String>,
|
TlsModel,
|
||||||
Option<(String, u64)>,
|
InstrumentCoverage,
|
||||||
Option<Vec<String>>,
|
|
||||||
Option<MergeFunctions>,
|
|
||||||
Option<RelocModel>,
|
|
||||||
Option<CodeModel>,
|
|
||||||
Option<TlsModel>,
|
|
||||||
Option<WasiExecModel>,
|
|
||||||
Option<PanicStrategy>,
|
|
||||||
Option<RelroLevel>,
|
|
||||||
Option<InstrumentCoverage>,
|
|
||||||
Option<lint::Level>,
|
|
||||||
Option<PathBuf>,
|
|
||||||
CrateType,
|
CrateType,
|
||||||
MergeFunctions,
|
MergeFunctions,
|
||||||
PanicStrategy,
|
PanicStrategy,
|
||||||
|
@ -2468,10 +2470,10 @@ crate mod dep_tracking {
|
||||||
TargetTriple,
|
TargetTriple,
|
||||||
Edition,
|
Edition,
|
||||||
LinkerPluginLto,
|
LinkerPluginLto,
|
||||||
Option<SplitDebuginfo>,
|
SplitDebuginfo,
|
||||||
SwitchWithOptPath,
|
SwitchWithOptPath,
|
||||||
Option<SymbolManglingVersion>,
|
SymbolManglingVersion,
|
||||||
Option<SourceFileHashAlgorithm>,
|
SourceFileHashAlgorithm,
|
||||||
TrimmedDefPaths,
|
TrimmedDefPaths,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue