1
1
//! Contains infrastructure for configuring the compiler, including parsing
2
2
//! command-line options.
3
3
4
- use rustc_session :: lint;
5
- use rustc_session :: utils:: NativeLibraryKind ;
6
- use crate :: session :: { early_error, early_warn, Session } ;
7
- use crate :: session :: search_paths:: SearchPath ;
4
+ use crate :: lint;
5
+ use crate :: utils:: NativeLibraryKind ;
6
+ use crate :: { early_error, early_warn, Session } ;
7
+ use crate :: search_paths:: SearchPath ;
8
8
9
9
use rustc_data_structures:: fx:: FxHashSet ;
10
- use rustc_feature :: UnstableFeatures ;
10
+ use rustc_data_structures :: impl_stable_hash_via_hash ;
11
11
12
12
use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelroLevel } ;
13
13
use rustc_target:: spec:: { Target , TargetTriple } ;
14
14
15
15
// Duplicated from syntax::ast for now
16
16
type CrateConfig = FxHashSet < ( Symbol , Option < Symbol > ) > ;
17
17
18
- use syntax:: source_map:: { FileName , FilePathMapping } ;
19
- use syntax:: edition:: { Edition , EDITION_NAME_LIST , DEFAULT_EDITION } ;
20
- use syntax:: symbol:: { sym, Symbol } ;
18
+ use syntax_pos:: source_map:: { FileName , FilePathMapping } ;
19
+ use syntax_pos:: edition:: { Edition , EDITION_NAME_LIST , DEFAULT_EDITION } ;
20
+ use syntax_pos:: symbol:: { sym, Symbol } ;
21
+ use rustc_feature:: UnstableFeatures ;
21
22
22
- use errors :: emitter:: HumanReadableErrorType ;
23
- use errors :: { ColorConfig , FatalError , Handler } ;
23
+ use rustc_errors :: emitter:: HumanReadableErrorType ;
24
+ use rustc_errors :: { ColorConfig , FatalError , Handler } ;
24
25
25
26
use getopts;
26
27
@@ -349,7 +350,7 @@ macro_rules! hash_option {
349
350
( $opt_name: ident, $opt_expr: expr, $sub_hashes: expr, [ TRACKED ] ) => ( {
350
351
if $sub_hashes. insert( stringify!( $opt_name) ,
351
352
$opt_expr as & dyn dep_tracking:: DepTrackingHash ) . is_some( ) {
352
- bug !( "duplicate key in CLI DepTrackingHash: {}" , stringify!( $opt_name) )
353
+ panic !( "duplicate key in CLI DepTrackingHash: {}" , stringify!( $opt_name) )
353
354
}
354
355
} ) ;
355
356
}
@@ -702,7 +703,7 @@ pub enum EntryFnType {
702
703
703
704
impl_stable_hash_via_hash ! ( EntryFnType ) ;
704
705
705
- #[ derive( Copy , PartialEq , PartialOrd , Clone , Ord , Eq , Hash , Debug , HashStable ) ]
706
+ #[ derive( Copy , PartialEq , PartialOrd , Clone , Ord , Eq , Hash , Debug ) ]
706
707
pub enum CrateType {
707
708
Executable ,
708
709
Dylib ,
@@ -712,6 +713,8 @@ pub enum CrateType {
712
713
ProcMacro ,
713
714
}
714
715
716
+ impl_stable_hash_via_hash ! ( CrateType ) ;
717
+
715
718
#[ derive( Clone , Hash ) ]
716
719
pub enum Passes {
717
720
Some ( Vec < String > ) ,
@@ -782,7 +785,7 @@ macro_rules! options {
782
785
value, $outputname,
783
786
key, type_desc) )
784
787
}
785
- ( None , None ) => bug !( )
788
+ ( None , None ) => panic !( )
786
789
}
787
790
}
788
791
found = true ;
@@ -2720,7 +2723,7 @@ pub mod nightly_options {
2720
2723
use getopts;
2721
2724
use rustc_feature:: UnstableFeatures ;
2722
2725
use super :: { ErrorOutputType , OptionStability , RustcOptGroup } ;
2723
- use crate :: session :: early_error;
2726
+ use crate :: early_error;
2724
2727
2725
2728
pub fn is_unstable_enabled ( matches : & getopts:: Matches ) -> bool {
2726
2729
is_nightly_build ( )
@@ -2858,18 +2861,18 @@ impl PpMode {
2858
2861
/// we have an opt-in scheme here, so one is hopefully forced to think about
2859
2862
/// how the hash should be calculated when adding a new command-line argument.
2860
2863
mod dep_tracking {
2861
- use rustc_session :: lint;
2862
- use rustc_session :: utils:: NativeLibraryKind ;
2864
+ use crate :: lint;
2865
+ use crate :: utils:: NativeLibraryKind ;
2863
2866
use std:: collections:: BTreeMap ;
2864
2867
use std:: hash:: Hash ;
2865
2868
use std:: path:: PathBuf ;
2866
2869
use std:: collections:: hash_map:: DefaultHasher ;
2867
2870
use super :: { CrateType , DebugInfo , ErrorOutputType , OptLevel , OutputTypes ,
2868
2871
Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath ,
2869
2872
SymbolManglingVersion } ;
2870
- use rustc_feature:: UnstableFeatures ;
2871
2873
use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel , TargetTriple } ;
2872
- use syntax:: edition:: Edition ;
2874
+ use syntax_pos:: edition:: Edition ;
2875
+ use rustc_feature:: UnstableFeatures ;
2873
2876
2874
2877
pub trait DepTrackingHash {
2875
2878
fn hash ( & self , hasher : & mut DefaultHasher , error_format : ErrorOutputType ) ;
0 commit comments