提交 76502deb 编写于 作者: J Joshua Nelson

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.
上级 c4c2ab57
......@@ -2427,30 +2427,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,
......@@ -2468,10 +2470,10 @@ fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) {
TargetTriple,
Edition,
LinkerPluginLto,
Option<SplitDebuginfo>,
SplitDebuginfo,
SwitchWithOptPath,
Option<SymbolManglingVersion>,
Option<SourceFileHashAlgorithm>,
SymbolManglingVersion,
SourceFileHashAlgorithm,
TrimmedDefPaths,
);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册