3
3
4
4
pub use crate :: options:: * ;
5
5
6
- use crate :: lint;
7
6
use crate :: search_paths:: SearchPath ;
8
7
use crate :: utils:: { CanonicalizedPath , NativeLib , NativeLibKind } ;
9
8
use crate :: { early_error, early_warn, Session } ;
9
+ use crate :: { lint, HashStableContext } ;
10
10
11
11
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
12
- use rustc_data_structures:: impl_stable_hash_via_hash;
13
12
13
+ use rustc_data_structures:: stable_hasher:: ToStableHashKey ;
14
14
use rustc_target:: abi:: { Align , TargetDataLayout } ;
15
15
use rustc_target:: spec:: { LinkerFlavor , SplitDebuginfo , Target , TargetTriple , TargetWarnings } ;
16
16
use rustc_target:: spec:: { PanicStrategy , SanitizerSet , TARGETS } ;
@@ -78,7 +78,7 @@ pub enum CFProtection {
78
78
Full ,
79
79
}
80
80
81
- #[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
81
+ #[ derive( Clone , Copy , Debug , PartialEq , Hash , HashStable_Generic ) ]
82
82
pub enum OptLevel {
83
83
No , // -O0
84
84
Less , // -O1
@@ -88,8 +88,6 @@ pub enum OptLevel {
88
88
SizeMin , // -Oz
89
89
}
90
90
91
- impl_stable_hash_via_hash ! ( OptLevel ) ;
92
-
93
91
/// This is what the `LtoCli` values get mapped to after resolving defaults and
94
92
/// and taking other command line options into account.
95
93
///
@@ -230,15 +228,13 @@ impl SwitchWithOptPath {
230
228
}
231
229
}
232
230
233
- #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
231
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable_Generic ) ]
234
232
#[ derive( Encodable , Decodable ) ]
235
233
pub enum SymbolManglingVersion {
236
234
Legacy ,
237
235
V0 ,
238
236
}
239
237
240
- impl_stable_hash_via_hash ! ( SymbolManglingVersion ) ;
241
-
242
238
#[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
243
239
pub enum DebugInfo {
244
240
None ,
@@ -277,7 +273,7 @@ impl FromStr for SplitDwarfKind {
277
273
}
278
274
}
279
275
280
- #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord ) ]
276
+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord , HashStable_Generic ) ]
281
277
#[ derive( Encodable , Decodable ) ]
282
278
pub enum OutputType {
283
279
Bitcode ,
@@ -290,7 +286,13 @@ pub enum OutputType {
290
286
DepInfo ,
291
287
}
292
288
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
+ }
294
296
295
297
impl OutputType {
296
298
fn is_compatible_with_codegen_units_and_single_output_file ( & self ) -> bool {
@@ -396,7 +398,7 @@ pub enum TrimmedDefPaths {
396
398
/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
397
399
/// dependency tracking for command-line arguments. Also only hash keys, since tracking
398
400
/// 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 ) ]
400
402
pub struct OutputTypes ( BTreeMap < OutputType , Option < PathBuf > > ) ;
401
403
402
404
impl OutputTypes {
@@ -585,7 +587,7 @@ impl Input {
585
587
}
586
588
}
587
589
588
- #[ derive( Clone , Hash , Debug ) ]
590
+ #[ derive( Clone , Hash , Debug , HashStable_Generic ) ]
589
591
pub struct OutputFilenames {
590
592
pub out_directory : PathBuf ,
591
593
filestem : String ,
@@ -594,8 +596,6 @@ pub struct OutputFilenames {
594
596
pub outputs : OutputTypes ,
595
597
}
596
598
597
- impl_stable_hash_via_hash ! ( OutputFilenames ) ;
598
-
599
599
pub const RLINK_EXT : & str = "rlink" ;
600
600
pub const RUST_CGU_EXT : & str = "rcgu" ;
601
601
pub const DWARF_OBJECT_EXT : & str = "dwo" ;
@@ -808,15 +808,14 @@ impl DebuggingOptions {
808
808
}
809
809
810
810
// 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 ) ]
812
812
pub enum EntryFnType {
813
813
Main ,
814
814
Start ,
815
815
}
816
816
817
- impl_stable_hash_via_hash ! ( EntryFnType ) ;
818
-
819
817
#[ derive( Copy , PartialEq , PartialOrd , Clone , Ord , Eq , Hash , Debug , Encodable , Decodable ) ]
818
+ #[ derive( HashStable_Generic ) ]
820
819
pub enum CrateType {
821
820
Executable ,
822
821
Dylib ,
@@ -826,8 +825,6 @@ pub enum CrateType {
826
825
ProcMacro ,
827
826
}
828
827
829
- impl_stable_hash_via_hash ! ( CrateType ) ;
830
-
831
828
impl CrateType {
832
829
/// When generated, is this crate type an archive?
833
830
pub fn is_archive ( & self ) -> bool {
0 commit comments