@@ -117,16 +117,16 @@ impl LinkerPluginLto {
117117}
118118
119119#[ derive( Clone , PartialEq , Hash ) ]
120- pub enum PgoGenerate {
120+ pub enum SwitchWithOptPath {
121121 Enabled ( Option < PathBuf > ) ,
122122 Disabled ,
123123}
124124
125- impl PgoGenerate {
125+ impl SwitchWithOptPath {
126126 pub fn enabled ( & self ) -> bool {
127127 match * self {
128- PgoGenerate :: Enabled ( _) => true ,
129- PgoGenerate :: Disabled => false ,
128+ SwitchWithOptPath :: Enabled ( _) => true ,
129+ SwitchWithOptPath :: Disabled => false ,
130130 }
131131 }
132132}
@@ -834,15 +834,15 @@ macro_rules! options {
834834 pub const parse_linker_plugin_lto: Option <& str > =
835835 Some ( "either a boolean (`yes`, `no`, `on`, `off`, etc), \
836836 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 > =
838838 Some ( "an optional path to the profiling data output directory" ) ;
839839 pub const parse_merge_functions: Option <& str > =
840840 Some ( "one of: `disabled`, `trampolines`, or `aliases`" ) ;
841841 }
842842
843843 #[ allow( dead_code) ]
844844 mod $mod_set {
845- use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto , PgoGenerate } ;
845+ use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath } ;
846846 use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelroLevel } ;
847847 use std:: path:: PathBuf ;
848848 use std:: str :: FromStr ;
@@ -1097,10 +1097,10 @@ macro_rules! options {
10971097 true
10981098 }
10991099
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 {
11011101 * 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) ) ) ,
11041104 } ;
11051105 true
11061106 }
@@ -1379,7 +1379,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13791379 "extra arguments to prepend to the linker invocation (space separated)" ) ,
13801380 profile: bool = ( false , parse_bool, [ TRACKED ] ,
13811381 "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 ] ,
13831384 "Generate PGO profile data, to a given file, or to the default location if it's empty." ) ,
13841385 pgo_use: Option <PathBuf > = ( None , parse_opt_pathbuf, [ TRACKED ] ,
13851386 "Use PGO profile data from the given profile file." ) ,
@@ -1447,7 +1448,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
14471448 "don't interleave execution of lints; allows benchmarking individual lints" ) ,
14481449 crate_attr: Vec <String > = ( Vec :: new( ) , parse_string_push, [ TRACKED ] ,
14491450 "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 ] ,
14511453 "run the self profiler and output the raw event data" ) ,
14521454 self_profile_events: Option <Vec <String >> = ( None , parse_opt_comma_list, [ UNTRACKED ] ,
14531455 "specifies which kinds of events get recorded by the self profiler" ) ,
@@ -2558,7 +2560,7 @@ mod dep_tracking {
25582560 use std:: path:: PathBuf ;
25592561 use std:: collections:: hash_map:: DefaultHasher ;
25602562 use super :: { CrateType , DebugInfo , ErrorOutputType , OptLevel , OutputTypes ,
2561- Passes , Sanitizer , LtoCli , LinkerPluginLto , PgoGenerate } ;
2563+ Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath } ;
25622564 use syntax:: feature_gate:: UnstableFeatures ;
25632565 use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel , TargetTriple } ;
25642566 use syntax:: edition:: Edition ;
@@ -2626,7 +2628,7 @@ mod dep_tracking {
26262628 impl_dep_tracking_hash_via_hash ! ( TargetTriple ) ;
26272629 impl_dep_tracking_hash_via_hash ! ( Edition ) ;
26282630 impl_dep_tracking_hash_via_hash ! ( LinkerPluginLto ) ;
2629- impl_dep_tracking_hash_via_hash ! ( PgoGenerate ) ;
2631+ impl_dep_tracking_hash_via_hash ! ( SwitchWithOptPath ) ;
26302632
26312633 impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
26322634 impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2694,7 +2696,7 @@ mod tests {
26942696 build_session_options_and_crate_config,
26952697 to_crate_config
26962698 } ;
2697- use crate :: session:: config:: { LtoCli , LinkerPluginLto , PgoGenerate , ExternEntry } ;
2699+ use crate :: session:: config:: { LtoCli , LinkerPluginLto , SwitchWithOptPath , ExternEntry } ;
26982700 use crate :: session:: build_session;
26992701 use crate :: session:: search_paths:: SearchPath ;
27002702 use std:: collections:: { BTreeMap , BTreeSet } ;
@@ -3207,7 +3209,7 @@ mod tests {
32073209 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
32083210
32093211 opts = reference. clone ( ) ;
3210- opts. debugging_opts . pgo_gen = PgoGenerate :: Enabled ( None ) ;
3212+ opts. debugging_opts . pgo_gen = SwitchWithOptPath :: Enabled ( None ) ;
32113213 assert_ne ! ( reference. dep_tracking_hash( ) , opts. dep_tracking_hash( ) ) ;
32123214
32133215 opts = reference. clone ( ) ;
0 commit comments