33
44pub use crate :: options:: * ;
55
6- use crate :: lint;
76use crate :: search_paths:: SearchPath ;
87use crate :: utils:: { CanonicalizedPath , NativeLib , NativeLibKind } ;
98use crate :: { early_error, early_warn, Session } ;
9+ use crate :: { lint, HashStableContext } ;
1010
1111use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
12- use rustc_data_structures:: impl_stable_hash_via_hash;
1312
13+ use rustc_data_structures:: stable_hasher:: ToStableHashKey ;
1414use rustc_target:: abi:: { Align , TargetDataLayout } ;
1515use rustc_target:: spec:: { LinkerFlavor , SplitDebuginfo , Target , TargetTriple , TargetWarnings } ;
1616use rustc_target:: spec:: { PanicStrategy , SanitizerSet , TARGETS } ;
@@ -78,7 +78,7 @@ pub enum CFProtection {
7878 Full ,
7979}
8080
81- #[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
81+ #[ derive( Clone , Copy , Debug , PartialEq , Hash , HashStable_Generic ) ]
8282pub enum OptLevel {
8383 No , // -O0
8484 Less , // -O1
@@ -88,8 +88,6 @@ pub enum OptLevel {
8888 SizeMin , // -Oz
8989}
9090
91- impl_stable_hash_via_hash ! ( OptLevel ) ;
92-
9391/// This is what the `LtoCli` values get mapped to after resolving defaults and
9492/// and taking other command line options into account.
9593///
@@ -230,15 +228,13 @@ impl SwitchWithOptPath {
230228 }
231229}
232230
233- #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
231+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable_Generic ) ]
234232#[ derive( Encodable , Decodable ) ]
235233pub enum SymbolManglingVersion {
236234 Legacy ,
237235 V0 ,
238236}
239237
240- impl_stable_hash_via_hash ! ( SymbolManglingVersion ) ;
241-
242238#[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
243239pub enum DebugInfo {
244240 None ,
@@ -277,7 +273,7 @@ impl FromStr for SplitDwarfKind {
277273 }
278274}
279275
280- #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord ) ]
276+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord , HashStable_Generic ) ]
281277#[ derive( Encodable , Decodable ) ]
282278pub enum OutputType {
283279 Bitcode ,
@@ -290,7 +286,13 @@ pub enum OutputType {
290286 DepInfo ,
291287}
292288
293- impl_stable_hash_via_hash ! ( OutputType ) ;
289+ impl < HCX : HashStableContext > ToStableHashKey < HCX > for OutputType {
290+ type KeyType = Self ;
291+
292+ fn to_stable_hash_key ( & self , _: & HCX ) -> Self :: KeyType {
293+ * self
294+ }
295+ }
294296
295297impl OutputType {
296298 fn is_compatible_with_codegen_units_and_single_output_file ( & self ) -> bool {
@@ -396,7 +398,7 @@ pub enum TrimmedDefPaths {
396398/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
397399/// dependency tracking for command-line arguments. Also only hash keys, since tracking
398400/// should only depend on the output types, not the paths they're written to.
399- #[ derive( Clone , Debug , Hash ) ]
401+ #[ derive( Clone , Debug , Hash , HashStable_Generic ) ]
400402pub struct OutputTypes ( BTreeMap < OutputType , Option < PathBuf > > ) ;
401403
402404impl OutputTypes {
@@ -585,7 +587,7 @@ impl Input {
585587 }
586588}
587589
588- #[ derive( Clone , Hash , Debug ) ]
590+ #[ derive( Clone , Hash , Debug , HashStable_Generic ) ]
589591pub struct OutputFilenames {
590592 pub out_directory : PathBuf ,
591593 filestem : String ,
@@ -594,8 +596,6 @@ pub struct OutputFilenames {
594596 pub outputs : OutputTypes ,
595597}
596598
597- impl_stable_hash_via_hash ! ( OutputFilenames ) ;
598-
599599pub const RLINK_EXT : & str = "rlink" ;
600600pub const RUST_CGU_EXT : & str = "rcgu" ;
601601pub const DWARF_OBJECT_EXT : & str = "dwo" ;
@@ -808,15 +808,14 @@ impl DebuggingOptions {
808808}
809809
810810// The type of entry function, so users can have their own entry functions
811- #[ derive( Copy , Clone , PartialEq , Hash , Debug ) ]
811+ #[ derive( Copy , Clone , PartialEq , Hash , Debug , HashStable_Generic ) ]
812812pub enum EntryFnType {
813813 Main ,
814814 Start ,
815815}
816816
817- impl_stable_hash_via_hash ! ( EntryFnType ) ;
818-
819817#[ derive( Copy , PartialEq , PartialOrd , Clone , Ord , Eq , Hash , Debug , Encodable , Decodable ) ]
818+ #[ derive( HashStable_Generic ) ]
820819pub enum CrateType {
821820 Executable ,
822821 Dylib ,
@@ -826,8 +825,6 @@ pub enum CrateType {
826825 ProcMacro ,
827826}
828827
829- impl_stable_hash_via_hash ! ( CrateType ) ;
830-
831828impl CrateType {
832829 /// When generated, is this crate type an archive?
833830 pub fn is_archive ( & self ) -> bool {
0 commit comments