Rollup merge of #84803 - jyn514:duplicate-macros, r=petrochenkov
Reduce duplication in `impl_dep_tracking_hash` macros Cherry-picked from https://github.com/rust-lang/rust/pull/84234 since it will be a while until it lands.
This commit is contained in:
commit
b1e152c7e5
@ -2332,17 +2332,17 @@ pub trait DepTrackingHash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_dep_tracking_hash_via_hash {
|
macro_rules! impl_dep_tracking_hash_via_hash {
|
||||||
($t:ty) => {
|
($($t:ty),+ $(,)?) => {$(
|
||||||
impl DepTrackingHash for $t {
|
impl DepTrackingHash for $t {
|
||||||
fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) {
|
fn hash(&self, hasher: &mut DefaultHasher, _: ErrorOutputType) {
|
||||||
Hash::hash(self, hasher);
|
Hash::hash(self, hasher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
)+};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_dep_tracking_hash_for_sortable_vec_of {
|
macro_rules! impl_dep_tracking_hash_for_sortable_vec_of {
|
||||||
($t:ty) => {
|
($($t:ty),+ $(,)?) => {$(
|
||||||
impl DepTrackingHash for Vec<$t> {
|
impl DepTrackingHash for Vec<$t> {
|
||||||
fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
|
fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
|
||||||
let mut elems: Vec<&$t> = self.iter().collect();
|
let mut elems: Vec<&$t> = self.iter().collect();
|
||||||
@ -2354,61 +2354,65 @@ fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
)+};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_dep_tracking_hash_via_hash!(bool);
|
impl_dep_tracking_hash_via_hash!(
|
||||||
impl_dep_tracking_hash_via_hash!(usize);
|
bool,
|
||||||
impl_dep_tracking_hash_via_hash!(u64);
|
usize,
|
||||||
impl_dep_tracking_hash_via_hash!(String);
|
u64,
|
||||||
impl_dep_tracking_hash_via_hash!(PathBuf);
|
String,
|
||||||
impl_dep_tracking_hash_via_hash!(lint::Level);
|
PathBuf,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<bool>);
|
lint::Level,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<u32>);
|
Option<bool>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<usize>);
|
Option<u32>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<NonZeroUsize>);
|
Option<usize>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<String>);
|
Option<NonZeroUsize>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<(String, u64)>);
|
Option<String>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<Vec<String>>);
|
Option<(String, u64)>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<MergeFunctions>);
|
Option<Vec<String>>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<RelocModel>);
|
Option<MergeFunctions>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<CodeModel>);
|
Option<RelocModel>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<TlsModel>);
|
Option<CodeModel>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<WasiExecModel>);
|
Option<TlsModel>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<PanicStrategy>);
|
Option<WasiExecModel>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<RelroLevel>);
|
Option<PanicStrategy>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<InstrumentCoverage>);
|
Option<RelroLevel>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<lint::Level>);
|
Option<InstrumentCoverage>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<PathBuf>);
|
Option<lint::Level>,
|
||||||
impl_dep_tracking_hash_via_hash!(CrateType);
|
Option<PathBuf>,
|
||||||
impl_dep_tracking_hash_via_hash!(MergeFunctions);
|
CrateType,
|
||||||
impl_dep_tracking_hash_via_hash!(PanicStrategy);
|
MergeFunctions,
|
||||||
impl_dep_tracking_hash_via_hash!(RelroLevel);
|
PanicStrategy,
|
||||||
impl_dep_tracking_hash_via_hash!(Passes);
|
RelroLevel,
|
||||||
impl_dep_tracking_hash_via_hash!(OptLevel);
|
Passes,
|
||||||
impl_dep_tracking_hash_via_hash!(LtoCli);
|
OptLevel,
|
||||||
impl_dep_tracking_hash_via_hash!(DebugInfo);
|
LtoCli,
|
||||||
impl_dep_tracking_hash_via_hash!(UnstableFeatures);
|
DebugInfo,
|
||||||
impl_dep_tracking_hash_via_hash!(OutputTypes);
|
UnstableFeatures,
|
||||||
impl_dep_tracking_hash_via_hash!(NativeLibKind);
|
OutputTypes,
|
||||||
impl_dep_tracking_hash_via_hash!(SanitizerSet);
|
NativeLibKind,
|
||||||
impl_dep_tracking_hash_via_hash!(CFGuard);
|
SanitizerSet,
|
||||||
impl_dep_tracking_hash_via_hash!(TargetTriple);
|
CFGuard,
|
||||||
impl_dep_tracking_hash_via_hash!(Edition);
|
TargetTriple,
|
||||||
impl_dep_tracking_hash_via_hash!(LinkerPluginLto);
|
Edition,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<SplitDebuginfo>);
|
LinkerPluginLto,
|
||||||
impl_dep_tracking_hash_via_hash!(SwitchWithOptPath);
|
Option<SplitDebuginfo>,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<SymbolManglingVersion>);
|
SwitchWithOptPath,
|
||||||
impl_dep_tracking_hash_via_hash!(Option<SourceFileHashAlgorithm>);
|
Option<SymbolManglingVersion>,
|
||||||
impl_dep_tracking_hash_via_hash!(TrimmedDefPaths);
|
Option<SourceFileHashAlgorithm>,
|
||||||
|
TrimmedDefPaths,
|
||||||
|
);
|
||||||
|
|
||||||
impl_dep_tracking_hash_for_sortable_vec_of!(String);
|
impl_dep_tracking_hash_for_sortable_vec_of!(
|
||||||
impl_dep_tracking_hash_for_sortable_vec_of!(PathBuf);
|
String,
|
||||||
impl_dep_tracking_hash_for_sortable_vec_of!((PathBuf, PathBuf));
|
PathBuf,
|
||||||
impl_dep_tracking_hash_for_sortable_vec_of!(CrateType);
|
(PathBuf, PathBuf),
|
||||||
impl_dep_tracking_hash_for_sortable_vec_of!((String, lint::Level));
|
CrateType,
|
||||||
impl_dep_tracking_hash_for_sortable_vec_of!((String, Option<String>, NativeLibKind));
|
(String, lint::Level),
|
||||||
impl_dep_tracking_hash_for_sortable_vec_of!((String, u64));
|
(String, Option<String>, NativeLibKind),
|
||||||
|
(String, u64)
|
||||||
|
);
|
||||||
|
|
||||||
impl<T1, T2> DepTrackingHash for (T1, T2)
|
impl<T1, T2> DepTrackingHash for (T1, T2)
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user