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 } ;
@@ -80,7 +80,7 @@ pub enum CFProtection {
8080 Full ,
8181}
8282
83- #[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
83+ #[ derive( Clone , Copy , Debug , PartialEq , Hash , HashStable_Generic ) ]
8484pub enum OptLevel {
8585 No , // -O0
8686 Less , // -O1
@@ -90,8 +90,6 @@ pub enum OptLevel {
9090 SizeMin , // -Oz
9191}
9292
93- impl_stable_hash_via_hash ! ( OptLevel ) ;
94-
9593/// This is what the `LtoCli` values get mapped to after resolving defaults and
9694/// and taking other command line options into account.
9795///
@@ -232,15 +230,13 @@ impl SwitchWithOptPath {
232230 }
233231}
234232
235- #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
233+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable_Generic ) ]
236234#[ derive( Encodable , Decodable ) ]
237235pub enum SymbolManglingVersion {
238236 Legacy ,
239237 V0 ,
240238}
241239
242- impl_stable_hash_via_hash ! ( SymbolManglingVersion ) ;
243-
244240#[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
245241pub enum DebugInfo {
246242 None ,
@@ -279,7 +275,7 @@ impl FromStr for SplitDwarfKind {
279275 }
280276}
281277
282- #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord ) ]
278+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord , HashStable_Generic ) ]
283279#[ derive( Encodable , Decodable ) ]
284280pub enum OutputType {
285281 Bitcode ,
@@ -292,7 +288,13 @@ pub enum OutputType {
292288 DepInfo ,
293289}
294290
295- impl_stable_hash_via_hash ! ( OutputType ) ;
291+ impl < HCX : HashStableContext > ToStableHashKey < HCX > for OutputType {
292+ type KeyType = Self ;
293+
294+ fn to_stable_hash_key ( & self , _: & HCX ) -> Self :: KeyType {
295+ * self
296+ }
297+ }
296298
297299impl OutputType {
298300 fn is_compatible_with_codegen_units_and_single_output_file ( & self ) -> bool {
@@ -398,7 +400,7 @@ pub enum TrimmedDefPaths {
398400/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
399401/// dependency tracking for command-line arguments. Also only hash keys, since tracking
400402/// should only depend on the output types, not the paths they're written to.
401- #[ derive( Clone , Debug , Hash ) ]
403+ #[ derive( Clone , Debug , Hash , HashStable_Generic ) ]
402404pub struct OutputTypes ( BTreeMap < OutputType , Option < PathBuf > > ) ;
403405
404406impl OutputTypes {
@@ -630,7 +632,7 @@ impl Input {
630632 }
631633}
632634
633- #[ derive( Clone , Hash , Debug ) ]
635+ #[ derive( Clone , Hash , Debug , HashStable_Generic ) ]
634636pub struct OutputFilenames {
635637 pub out_directory : PathBuf ,
636638 filestem : String ,
@@ -639,8 +641,6 @@ pub struct OutputFilenames {
639641 pub outputs : OutputTypes ,
640642}
641643
642- impl_stable_hash_via_hash ! ( OutputFilenames ) ;
643-
644644pub const RLINK_EXT : & str = "rlink" ;
645645pub const RUST_CGU_EXT : & str = "rcgu" ;
646646pub const DWARF_OBJECT_EXT : & str = "dwo" ;
@@ -854,15 +854,14 @@ impl DebuggingOptions {
854854}
855855
856856// The type of entry function, so users can have their own entry functions
857- #[ derive( Copy , Clone , PartialEq , Hash , Debug ) ]
857+ #[ derive( Copy , Clone , PartialEq , Hash , Debug , HashStable_Generic ) ]
858858pub enum EntryFnType {
859859 Main ,
860860 Start ,
861861}
862862
863- impl_stable_hash_via_hash ! ( EntryFnType ) ;
864-
865863#[ derive( Copy , PartialEq , PartialOrd , Clone , Ord , Eq , Hash , Debug , Encodable , Decodable ) ]
864+ #[ derive( HashStable_Generic ) ]
866865pub enum CrateType {
867866 Executable ,
868867 Dylib ,
@@ -872,8 +871,6 @@ pub enum CrateType {
872871 ProcMacro ,
873872}
874873
875- impl_stable_hash_via_hash ! ( CrateType ) ;
876-
877874impl CrateType {
878875 /// When generated, is this crate type an archive?
879876 pub fn is_archive ( & self ) -> bool {
0 commit comments