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 } ;
@@ -80,7 +80,7 @@ pub enum CFProtection {
80
80
Full ,
81
81
}
82
82
83
- #[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
83
+ #[ derive( Clone , Copy , Debug , PartialEq , Hash , HashStable_Generic ) ]
84
84
pub enum OptLevel {
85
85
No , // -O0
86
86
Less , // -O1
@@ -90,8 +90,6 @@ pub enum OptLevel {
90
90
SizeMin , // -Oz
91
91
}
92
92
93
- impl_stable_hash_via_hash ! ( OptLevel ) ;
94
-
95
93
/// This is what the `LtoCli` values get mapped to after resolving defaults and
96
94
/// and taking other command line options into account.
97
95
///
@@ -232,15 +230,13 @@ impl SwitchWithOptPath {
232
230
}
233
231
}
234
232
235
- #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
233
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , HashStable_Generic ) ]
236
234
#[ derive( Encodable , Decodable ) ]
237
235
pub enum SymbolManglingVersion {
238
236
Legacy ,
239
237
V0 ,
240
238
}
241
239
242
- impl_stable_hash_via_hash ! ( SymbolManglingVersion ) ;
243
-
244
240
#[ derive( Clone , Copy , Debug , PartialEq , Hash ) ]
245
241
pub enum DebugInfo {
246
242
None ,
@@ -279,7 +275,7 @@ impl FromStr for SplitDwarfKind {
279
275
}
280
276
}
281
277
282
- #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord ) ]
278
+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , PartialOrd , Ord , HashStable_Generic ) ]
283
279
#[ derive( Encodable , Decodable ) ]
284
280
pub enum OutputType {
285
281
Bitcode ,
@@ -292,7 +288,13 @@ pub enum OutputType {
292
288
DepInfo ,
293
289
}
294
290
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
+ }
296
298
297
299
impl OutputType {
298
300
fn is_compatible_with_codegen_units_and_single_output_file ( & self ) -> bool {
@@ -398,7 +400,7 @@ pub enum TrimmedDefPaths {
398
400
/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
399
401
/// dependency tracking for command-line arguments. Also only hash keys, since tracking
400
402
/// 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 ) ]
402
404
pub struct OutputTypes ( BTreeMap < OutputType , Option < PathBuf > > ) ;
403
405
404
406
impl OutputTypes {
@@ -630,7 +632,7 @@ impl Input {
630
632
}
631
633
}
632
634
633
- #[ derive( Clone , Hash , Debug ) ]
635
+ #[ derive( Clone , Hash , Debug , HashStable_Generic ) ]
634
636
pub struct OutputFilenames {
635
637
pub out_directory : PathBuf ,
636
638
filestem : String ,
@@ -639,8 +641,6 @@ pub struct OutputFilenames {
639
641
pub outputs : OutputTypes ,
640
642
}
641
643
642
- impl_stable_hash_via_hash ! ( OutputFilenames ) ;
643
-
644
644
pub const RLINK_EXT : & str = "rlink" ;
645
645
pub const RUST_CGU_EXT : & str = "rcgu" ;
646
646
pub const DWARF_OBJECT_EXT : & str = "dwo" ;
@@ -854,15 +854,14 @@ impl DebuggingOptions {
854
854
}
855
855
856
856
// 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 ) ]
858
858
pub enum EntryFnType {
859
859
Main ,
860
860
Start ,
861
861
}
862
862
863
- impl_stable_hash_via_hash ! ( EntryFnType ) ;
864
-
865
863
#[ derive( Copy , PartialEq , PartialOrd , Clone , Ord , Eq , Hash , Debug , Encodable , Decodable ) ]
864
+ #[ derive( HashStable_Generic ) ]
866
865
pub enum CrateType {
867
866
Executable ,
868
867
Dylib ,
@@ -872,8 +871,6 @@ pub enum CrateType {
872
871
ProcMacro ,
873
872
}
874
873
875
- impl_stable_hash_via_hash ! ( CrateType ) ;
876
-
877
874
impl CrateType {
878
875
/// When generated, is this crate type an archive?
879
876
pub fn is_archive ( & self ) -> bool {
0 commit comments