@@ -117,16 +117,16 @@ impl LinkerPluginLto {
117
117
}
118
118
119
119
#[ derive( Clone , PartialEq , Hash ) ]
120
- pub enum PgoGenerate {
120
+ pub enum SwitchWithOptPath {
121
121
Enabled ( Option < PathBuf > ) ,
122
122
Disabled ,
123
123
}
124
124
125
- impl PgoGenerate {
125
+ impl SwitchWithOptPath {
126
126
pub fn enabled ( & self ) -> bool {
127
127
match * self {
128
- PgoGenerate :: Enabled ( _) => true ,
129
- PgoGenerate :: Disabled => false ,
128
+ SwitchWithOptPath :: Enabled ( _) => true ,
129
+ SwitchWithOptPath :: Disabled => false ,
130
130
}
131
131
}
132
132
}
@@ -834,15 +834,15 @@ macro_rules! options {
834
834
pub const parse_linker_plugin_lto: Option <& str > =
835
835
Some ( "either a boolean (`yes`, `no`, `on`, `off`, etc), \
836
836
or the path to the linker plugin") ;
837
- pub const parse_pgo_generate : Option <& str > =
837
+ pub const parse_switch_with_opt_path : Option <& str > =
838
838
Some ( "an optional path to the profiling data output directory" ) ;
839
839
pub const parse_merge_functions: Option <& str > =
840
840
Some ( "one of: `disabled`, `trampolines`, or `aliases`" ) ;
841
841
}
842
842
843
843
#[ allow( dead_code) ]
844
844
mod $mod_set {
845
- use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto , PgoGenerate } ;
845
+ use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath } ;
846
846
use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelroLevel } ;
847
847
use std:: path:: PathBuf ;
848
848
use std:: str :: FromStr ;
@@ -1097,10 +1097,10 @@ macro_rules! options {
1097
1097
true
1098
1098
}
1099
1099
1100
- fn parse_pgo_generate ( slot: & mut PgoGenerate , v: Option <& str >) -> bool {
1100
+ fn parse_switch_with_opt_path ( slot: & mut SwitchWithOptPath , v: Option <& str >) -> bool {
1101
1101
* slot = match v {
1102
- None => PgoGenerate :: Enabled ( None ) ,
1103
- Some ( path) => PgoGenerate :: Enabled ( Some ( PathBuf :: from( path) ) ) ,
1102
+ None => SwitchWithOptPath :: Enabled ( None ) ,
1103
+ Some ( path) => SwitchWithOptPath :: Enabled ( Some ( PathBuf :: from( path) ) ) ,
1104
1104
} ;
1105
1105
true
1106
1106
}
@@ -1379,7 +1379,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1379
1379
"extra arguments to prepend to the linker invocation (space separated)" ) ,
1380
1380
profile: bool = ( false , parse_bool, [ TRACKED ] ,
1381
1381
"insert profiling code" ) ,
1382
- pgo_gen: PgoGenerate = ( PgoGenerate :: Disabled , parse_pgo_generate, [ TRACKED ] ,
1382
+ pgo_gen: SwitchWithOptPath = ( SwitchWithOptPath :: Disabled ,
1383
+ parse_switch_with_opt_path, [ TRACKED ] ,
1383
1384
"Generate PGO profile data, to a given file, or to the default location if it's empty." ) ,
1384
1385
pgo_use: Option <PathBuf > = ( None , parse_opt_pathbuf, [ TRACKED ] ,
1385
1386
"Use PGO profile data from the given profile file." ) ,
@@ -1447,7 +1448,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1447
1448
"don't interleave execution of lints; allows benchmarking individual lints" ) ,
1448
1449
crate_attr: Vec <String > = ( Vec :: new( ) , parse_string_push, [ TRACKED ] ,
1449
1450
"inject the given attribute in the crate" ) ,
1450
- self_profile: bool = ( false , parse_bool, [ UNTRACKED ] ,
1451
+ self_profile: SwitchWithOptPath = ( SwitchWithOptPath :: Disabled ,
1452
+ parse_switch_with_opt_path, [ UNTRACKED ] ,
1451
1453
"run the self profiler and output the raw event data" ) ,
1452
1454
self_profile_events: Option <Vec <String >> = ( None , parse_opt_comma_list, [ UNTRACKED ] ,
1453
1455
"specifies which kinds of events get recorded by the self profiler" ) ,
@@ -2558,7 +2560,7 @@ mod dep_tracking {
2558
2560
use std:: path:: PathBuf ;
2559
2561
use std:: collections:: hash_map:: DefaultHasher ;
2560
2562
use super :: { CrateType , DebugInfo , ErrorOutputType , OptLevel , OutputTypes ,
2561
- Passes , Sanitizer , LtoCli , LinkerPluginLto , PgoGenerate } ;
2563
+ Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath } ;
2562
2564
use syntax:: feature_gate:: UnstableFeatures ;
2563
2565
use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel , TargetTriple } ;
2564
2566
use syntax:: edition:: Edition ;
@@ -2626,7 +2628,7 @@ mod dep_tracking {
2626
2628
impl_dep_tracking_hash_via_hash ! ( TargetTriple ) ;
2627
2629
impl_dep_tracking_hash_via_hash ! ( Edition ) ;
2628
2630
impl_dep_tracking_hash_via_hash ! ( LinkerPluginLto ) ;
2629
- impl_dep_tracking_hash_via_hash ! ( PgoGenerate ) ;
2631
+ impl_dep_tracking_hash_via_hash ! ( SwitchWithOptPath ) ;
2630
2632
2631
2633
impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
2632
2634
impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2694,7 +2696,7 @@ mod tests {
2694
2696
build_session_options_and_crate_config,
2695
2697
to_crate_config
2696
2698
} ;
2697
- use crate :: session:: config:: { LtoCli , LinkerPluginLto , PgoGenerate , ExternEntry } ;
2699
+ use crate :: session:: config:: { LtoCli , LinkerPluginLto , SwitchWithOptPath , ExternEntry } ;
2698
2700
use crate :: session:: build_session;
2699
2701
use crate :: session:: search_paths:: SearchPath ;
2700
2702
use std:: collections:: { BTreeMap , BTreeSet } ;
@@ -3207,7 +3209,7 @@ mod tests {
3207
3209
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
3208
3210
3209
3211
opts = reference. clone ( ) ;
3210
- opts. debugging_opts . pgo_gen = PgoGenerate :: Enabled ( None ) ;
3212
+ opts. debugging_opts . pgo_gen = SwitchWithOptPath :: Enabled ( None ) ;
3211
3213
assert_ne ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
3212
3214
3213
3215
opts = reference. clone ( ) ;
0 commit comments